Améliorations des titres des fenêtres de jets

This commit is contained in:
2026-07-10 23:37:42 +02:00
parent 89207df01d
commit 6636ebb77c
12 changed files with 37 additions and 16 deletions
+1
View File
@@ -10,6 +10,7 @@
- Les rencontres et les maîtrises dans les TMR peuvent être vaincues sans
draconic si les voies sont négatives
- correction d'updates non affichés
- Améliorations des titres des fenêtres de jets
## 13.0.47 - Les goûts et les couleurs d'Illisys
+10 -5
View File
@@ -1838,12 +1838,12 @@ export class RdDActor extends RdDBaseActorSang {
return undefined;
}
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
async rollCaracCompetence(caracName, compName, diff, options = { title: undefined, verb: undefined }) {
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
const rollData = {
ids: { actorId: this.id },
type: { allowed: [ROLL_TYPE_COMP], current: ROLL_TYPE_COMP },
type: { allowed: [ROLL_TYPE_COMP], current: ROLL_TYPE_COMP, label: options.verb },
selected: {
carac: { key: caracName },
comp: { key: compName, forced: options.forced },
@@ -1879,10 +1879,11 @@ export class RdDActor extends RdDBaseActorSang {
RdDEmpoignade.checkEmpoignadeEnCours(this)
const tache = this.getTache(id)
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
options.title = options.title ?? 'Jet de Tâche'
const rollData = {
ids: { actorId: this.id },
selected: { tache: { key: tache.id, forced: options.forced } },
type: { allowed: [ROLL_TYPE_TACHE], current: ROLL_TYPE_TACHE }
type: { allowed: [ROLL_TYPE_TACHE], current: ROLL_TYPE_TACHE}
}
return await RollDialog.create(rollData, options)
}
@@ -2409,7 +2410,9 @@ export class RdDActor extends RdDBaseActorSang {
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
verb: "soigne",
title: 'Premiers soins',
forced: true
});
}
else if (!blessure.system.soinscomplets.done) {
@@ -2417,7 +2420,9 @@ export class RdDActor extends RdDBaseActorSang {
return await this.rollCaracCompetence(CARACS.DEXTERITE, "Chirurgie", diff, {
callbacks: [async r => await blesse.onRollSoinsComplets(blessureId, r, this.id)],
onRollDone: RollDialog.onRollDoneClose,
title: "Soins complets", forced: true
verb: "applique des soins complets à",
title: "Soins complets",
forced: true
})
}
}
+2 -2
View File
@@ -59,8 +59,8 @@ export class RdDCombatManager extends Combat {
static getCombatant(actorId, tokenId) {
return game.combat?.combatants.find(it => it.actor.id == actorId &&
it.token.id == tokenId
return game.combat?.combatants.find(it => it.actorId == actorId &&
it.tokenId == tokenId
)
}
+6 -5
View File
@@ -90,7 +90,7 @@ const ROLL_PARTS = [
new RollPartCuisine(),
new RollPartOeuvre(),
new RollPartJeu(),
new RollPartDiff(),
new RollPartConditions(),
new RollPartEtat(),
@@ -379,7 +379,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
this.hooks = []
this.rollData = rollData
this.rollOptions = {
this.rollOptions = foundry.utils.mergeObject(rollOptions, {
callbacks: [
async r => await r.active.actor.ajoutExperience(r),
async r => await r.active.actor.appliquerAppelMoral(r),
@@ -387,7 +387,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
],
onRollDone: rollOptions.onRollDone ?? RollDialog.onRollDoneDoNothing,
onClose: rollOptions.onClose ?? RollDialog.onCloseDoNothing
}
})
this.chatRollResult = new ChatRollResult()
this.rollParts = RollDialog.getAllowedParts(rollData)
@@ -429,9 +429,10 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
.filter(it => it.section == ROLLDIALOG_SECTION.ACTION)
.filter(it => it.isActive(rollData))
.map(it => it.title(rollData))
.filter(it => it != undefined)
.reduce(Misc.joining(' '));
if (this.rollOptions.title) {
return `${this.rollOptions.title} ${title}`
return `${this.rollOptions.title}: ${title}`
}
return title
}
@@ -479,7 +480,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
.map(m => m.toTypeData(rollData))
RollBasicParts.loadSurprises(rollData, this.getSelectedType().code)
rollData.type.label = this.getSelectedType()?.title(rollData)
this.getActiveParts().forEach(p => p.applyExternalImpacts(this.getActiveParts(), rollData))
this.setSpecialComp(this.getActiveParts());
this.getActiveParts().forEach(p => p.prepareContext(rollData))
+2 -1
View File
@@ -8,7 +8,8 @@ export class RollPartAction extends RollPart {
get section() { return ROLLDIALOG_SECTION.ACTION }
title(rollData) {
return rollData.type.label
const current = this.getCurrent(rollData)
return current.verb
}
prepareContext(rollData) {
+2
View File
@@ -7,6 +7,8 @@ export class RollTypeAttaque extends RollType {
title(rollData) { return `attaque` }
isOpposed(rollData) { return rollData.opponent != undefined }
onSelect(rollData) {
this.setDiffType(rollData, DIFF.ATTAQUE)
}
+3
View File
@@ -6,6 +6,9 @@ export class RollTypeComp extends RollType {
get name() { return `Jet de caractéristique / compétence` }
title(rollData) {
if (rollData.type.label) {
return rollData.type.label
}
if (rollData.type.appreciation) {
return "fait un jet d'appéciation"
}
+2
View File
@@ -7,6 +7,8 @@ export class RollTypeDefense extends RollType {
title(rollData) { return `se défend${rollData.opponent ? ' de' : ''}` }
isOpposed(rollData) { return this.getOpponent(rollData) != undefined }
getOpponent(rollData) {
return rollData.attacker
}
+3
View File
@@ -13,6 +13,9 @@ export class RollTypeJeu extends RollType {
&& RollConstants.findCompetence(rollData, 'Jeu')
}
isOpposed(rollData) { return rollData.opponent != undefined }
title(rollData) {
if (rollData.opponent) {
return `joue contre`
+2
View File
@@ -14,6 +14,8 @@ export class RollTypePossession extends RollType {
return RdDPossessionV2.actionTitle(rollData.type.possession.action)
}
isOpposed(rollData) { return rollData.opponent != undefined }
onSelect(rollData) {
this.setDiffType(rollData, this.isAttaque(rollData) ? DIFF.ATTAQUE : DIFF.DEFENSE)
}
+1 -1
View File
@@ -11,7 +11,7 @@ export class RollTypeTache extends RollType {
title(rollData) {
const current = rollData.current[PART_TACHE]
const tache = current?.tache
return tache ? `travaille à sa tâche: ${tache.name}` : `n'a pas de tâches à travailler`
return tache ? "travaille à la tâche" : "n'a pas de tâches en cours"
}
onSelect(rollData) {
+3 -2
View File
@@ -19,9 +19,10 @@ export class RollType {
visible(rollData) { return true }
title(rollData) { return this.code }
isSelected(rollData) { return rollData.type.current == this.code }
isOpposed(rollData) { return false }
setRollDataType(rollData) {
rollData.type.opposed = rollData.opponent != undefined
rollData.type.opposed = this.isOpposed(rollData)
}
onSelect(rollData) {