Merge pull request '13.0.30 - Le pansement d'Illysis' (#795) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 1m27s

Reviewed-on: https, #795
This commit was merged in pull request #795.
This commit is contained in:
2026-02-18 00:43:46 +01:00
18 changed files with 98 additions and 85 deletions

View File

@@ -1,5 +1,11 @@
# 13.0
## 13.0.30 - Le pansement d'Illysis
- les soins d'un joueur à l'autre fonctionne de nouveau
- la fenêtre de jet de compétence s'ouvre avec la caractéristique et la difficulté par défaut
- on peut saisir des valeurs négatives au clavier en sélectionnant les conditions/difficultés
## 13.0.29 - Le tricorne d'Illysis
- gestion des attaques avec jets V2 depuis l'onglet de combat
@@ -13,7 +19,7 @@
- L'appel au moral dans le tchat ne déplace plus les boutons d'appel à la chance
- Correction d'apparence V13
- la fenêtre de choix des status utilisés est affichée correctement
- la fenêtrre d'astrologir MJ est affichée correctement
- la fenêtre d'astrologie MJ est affichée correctement
## 13.0.27 - Les lunettes d'Illysis

View File

@@ -2504,9 +2504,9 @@ export class RdDActor extends RdDBaseActorSang {
const blessure = blesse.blessuresASoigner().find(it => it.id == blessureId);
if (blessure) {
if (!blessure.system.premierssoins.done) {
const tache = await this.getTacheBlessure(blesse, blessure);
return await this.rollTache(tache.id, {
callbacks: [async r => await blesse.onRollTachePremiersSoins(blessureId, r, this.id)],
const tacheId = (await this.getTacheBlessure(blesse, blessure))?.id
return await this.rollTache(tacheId, {
callbacks: [async r => await blesse.callbackPremiersSoins(blessureId, r, this.id)],
title: 'Premiers soins', forced: true
});
}

View File

@@ -179,19 +179,24 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
return result
}
async onRollTachePremiersSoins(blessureId, rollData, soigneurId) {
async callbackPremiersSoins(blessureId, rollData, soigneurId) {
await this.onRollTachePremiersSoins(blessureId,
rollData.v2 ? rollData.current.tache.tache : rollData.tache,
rollData.rolled.isETotal,
soigneurId)
}
async onRollTachePremiersSoins(blessureId, tache, isETotal, soigneurId) {
if (!this.isOwner) {
return RdDBaseActor.remoteActorCall({
tokenId: this.token?.id,
actorId: this.id,
method: 'onRollTachePremiersSoins', args: [blessureId, rollData, soigneurId]
method: 'onRollTachePremiersSoins', args: [blessureId, tache, isETotal, soigneurId]
})
}
const blessure = this.getItem(blessureId, 'blessure')
if (blessure && !blessure.system.premierssoins.done) {
const tache = rollData.v2 ? rollData.current.tache.tache : rollData.tache
if (rollData.rolled.isETotal) {
if (isETotal) {
await blessure.update({
'system.difficulte': blessure.system.difficulte - 1,
'system.premierssoins.tache': Math.max(0, tache.system.points_de_tache_courant)

View File

@@ -218,7 +218,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
foundry.applications.handlebars.loadTemplates(ALL_ROLL_TYPES.map(m => m.chatResultTemplate))
foundry.applications.handlebars.loadTemplates(ROLL_PARTS.map(p => p.template))
ROLL_PARTS.forEach(p => p.onReady())
ROLL_PARTS.forEach(p => p.onReady(ROLL_PARTS))
Handlebars.registerHelper('roll-centered-array', (base, show) => {
show = Math.abs(show)

View File

@@ -1,5 +1,7 @@
import { Grammar } from "../grammar.js"
import { Misc } from "../misc.js"
import { PART_CARAC } from "./roll-part-carac.mjs"
import { PART_DIFF } from "./roll-part-diff.mjs"
import { RollPartSelect } from "./roll-part-select.mjs"
import { ROLLDIALOG_SECTION } from "./roll-part.mjs"
@@ -15,15 +17,21 @@ export class RollPartComp extends RollPartSelect {
get name() { return 'Compétences' }
get section() { return ROLLDIALOG_SECTION.COMP }
onReady(rollParts) {
this.rollPartCarac = rollParts.find(it => it.code == PART_CARAC)
this.rollPartDiff = rollParts.find(it => it.code == PART_DIFF)
}
loadRefs(rollData) {
const refs = this.getRefs(rollData)
const selected = this.getSelected(rollData)
const all = this.$getActorComps(rollData)
if (selected.forced) {
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selected.key))
const selectedComp = selected.key
if (selected.forced && selectedComp) {
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selectedComp))
if (refs.all.length == 0) {
if (selected.key && selected.key.length > 0) {
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selectedComp))
}
else {
refs.all = all.filter(comp => comp == SANS_COMPETENCE)
@@ -35,6 +43,11 @@ export class RollPartComp extends RollPartSelect {
}
refs.comps = refs.all
this.$selectComp(rollData)
if (rollData.type.current == PART_COMP && selectedComp) {
const current = this.getCurrent(rollData)
this.rollPartCarac.selectByKey(rollData, current.comp.system.defaut_carac)
this.rollPartDiff.setDiff(rollData, current.comp.system.default_diffLibre)
}
}
choices(refs) { return refs.comps }
@@ -71,6 +84,7 @@ export class RollPartComp extends RollPartSelect {
refs.comps.sort(sorting)
}
this.$selectComp(rollData)
}
prepareContext(rollData) {

View File

@@ -10,7 +10,7 @@ export class RollPartConditions extends RollPart {
settingMin() { return RollPart.settingKey(this, 'min') }
settingMax() { return RollPart.settingKey(this, 'max') }
onReady() {
onReady(rollParts) {
game.settings.register(SYSTEM_RDD, this.settingMin(),
{
name: "Malus maximal de conditions",
@@ -65,12 +65,7 @@ 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("input", e => this.onInputChange(e, rollDialog))
}
onInputChange(event, rollDialog) {
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
rollDialog.render()
input?.addEventListener("input", e => this.onNumericInputChange(e, rollDialog))
}
}

View File

@@ -9,7 +9,7 @@ import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
export const PART_CUISINE = "cuisine"
export class RollPartCuisine extends RollPartSelect {
onReady() {
onReady(rollParts) {
foundry.applications.handlebars.loadTemplates({ 'roll-oeuvre-recettecuisine': `systems/foundryvtt-reve-de-dragon/templates/roll/roll-oeuvre-recettecuisine.hbs` })
}

View File

@@ -73,12 +73,7 @@ export class RollPartDiff extends RollPart {
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).value = parseInt(event.currentTarget.value)
rollDialog.render()
input?.addEventListener("input", e => this.onNumericInputChange(e, rollDialog))
}
}

View File

@@ -24,7 +24,7 @@ const ARTS = [
]
export class RollPartOeuvre extends RollPartSelect {
onReady() {
onReady(rollParts) {
ARTS.forEach(art => art.label = Misc.typeName('Item', art.type))
ARTS.map(it => `roll-oeuvre-${it.type}`)
.forEach(art =>

View File

@@ -12,7 +12,7 @@ export const PART_SORT = "sort"
export class RollPartSort extends RollPartSelect {
onReady() {
onReady(rollParts) {
// TODO: utiliser un hook pour écouter les déplacements dans les TMRs?
}

View File

@@ -1,5 +1,3 @@
import { ALL_ROLL_TYPES } from "./roll-dialog.mjs"
export const ROLLDIALOG_SECTION = {
ACTION: 'action',
CARAC: 'carac',
@@ -9,7 +7,6 @@ export const ROLLDIALOG_SECTION = {
AJUSTEMENTS: 'ajustements',
}
export class RollPart {
static settingKey(rollPart, key) { return `roll-part-${rollPart.code}.${key}` }
@@ -75,7 +72,7 @@ export class RollPart {
isValid(rollData) { return true }
visible(rollData) { return true }
onReady() { }
onReady(rollParts) { }
loadRefs(rollData) { }
prepareContext(rollData) { }
@@ -103,4 +100,13 @@ export class RollPart {
async _onRender(rollDialog, context, options) { }
getHooks() { return [] }
onNumericInputChange(event, rollDialog, setValue = value => this.getCurrent(rollDialog.rollData).value = value) {
if (isNaN(event.currentTarget.value) || event.currentTarget.value == "") {
return
}
setValue(parseInt(event.currentTarget.value))
rollDialog.render()
}
}

View File

@@ -5,8 +5,6 @@ const DEFAULT_DIFF_TYPES = [DIFF.LIBRE, DIFF.IMPOSEE, DIFF.DEFAUT]
export class RollType {
onReady() { }
get code() { throw new Error(`Pas de code défini pour ${this}`) }
get name() { return this.code }
get icon() { return `systems/foundryvtt-reve-de-dragon/assets/actions/${this.code}.svg` }

View File

@@ -1,8 +1,7 @@
<label for="{{code}}">Conditions</label>
{{numberInput current.value
name=name
step=1
min=current.min
max=current.max
disabled=rollData.type.retry
}}
<input type="number"
name="{{name}}"
value="{{current.value}}"
pattern="^(-|+)?\d+$"
min="{{current.min}}" max="{{current.max}}" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>

View File

@@ -9,24 +9,23 @@
{{#if current.recette}}
<selected-numeric-value>{{plusMoins current.value}}</selected-numeric-value>
{{else if current.ingredient}}
{{numberInput current.value
name='diff-var'
step=1
min=-10
max=0
disabled=rollData.type.retry
}}
<input type="number"
name='diff-var'
value="{{current.value}}"
pattern="^(-|+)?\d+$"
min="-10" max="0" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>
{{/if}}
</subline>
<subline>
<label for="proportions">Proportions</label>
{{numberInput current.proportions
<input type="number"
name='proportions'
step=1
min=1
max=(either current.proportionsMax 10)
disabled=rollData.type.retry
}}
value="{{current.proportions}}"
pattern="^\d+$"
min="1" max="{{either current.proportionsMax 10}}" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>
{{#if (and current.sust (ne current.sust 1))}}<span>(&times; {{current.sust}})</span>{{/if}}
</subline>
<subline>

View File

@@ -1,10 +1,9 @@
<subline>
<label for="{{code}}">{{current.label}}&nbsp;</label>
{{numberInput current.value
name=name
step=1
min=current.min
max=current.max
disabled=(or rollData.type.retry current.disabled)
}}
<input type="number"
name="{{name}}"
value="{{current.value}}"
pattern="^(-|+)?\d+$"
min="{{current.min}}" max="{{current.max}}" step="1"
{{#if (or rollData.type.retry current.disabled)}}disabled{{/if}}>
</subline>

View File

@@ -6,10 +6,9 @@
{{current.label}}
</label>
<label for="malusenc"></label>
{{numberInput current.value
<input type="number"
name='malusenc'
step=1
min=-30
max=0
disabled=rollData.type.retry
}}
value="{{current.value}}"
pattern="^(-)?\d+$"
min="-30" max="0" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>

View File

@@ -8,13 +8,12 @@
{{selectOptions refs.sorts selected=current.key valueAttr="key" labelAttr="label"}}
</select>
{{#if current.isDiffVariable}}
{{numberInput current.value
<input type="number"
name='diff-var'
step=1
min=-20
max=-1
disabled=rollData.type.retry
}}
value="{{current.value}}"
pattern="^(-)?\d+$"
min="-20" max="-1" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>
{{else}}
<selected-numeric-value>{{plusMoins current.value}}</selected-numeric-value>
{{/if}}
@@ -23,13 +22,13 @@
<label for="ptreve-var">Rêve {{itemSort-coutReve current.sort}}&nbsp;</span>
</label>
{{#if current.isReveVariable}}
{{numberInput current.ptreve
<input type="number"
name='ptreve-var'
step=1
min=1
max=30
disabled=rollData.type.retry
}}
value="{{current.ptreve}}"
pattern="^\d+$"
min="{{1}}" max="{{60}}" step="1"
{{#if rollData.type.retry}}disabled{{/if}}>
{{/if}}
<span>&nbsp;(actuel: {{rollData.active.actor.system.reve.reve.value}})</span>
</subline>

View File

@@ -1,8 +1,7 @@
<label for="{{name}}">Forcer </label>
<img src="systems/foundryvtt-reve-de-dragon/assets/ui/d100.svg" data-tooltip="Forcer le résultat du jet de dé"/>
{{numberInput current.resultat
name=name
step=1
min=-1
max=100
}}
<input type="number"
name="{{name}}"
value="{{current.resultat}}"
pattern="^(-|+)?\d+$"
min="-1" max="100" step="1">