diff --git a/changelog.md b/changelog.md index ced58bd1..62424126 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/module/actor.js b/module/actor.js index 02026dcf..1609ecab 100644 --- a/module/actor.js +++ b/module/actor.js @@ -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 }) } } diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 00f3184e..fd80e676 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -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 ) } diff --git a/module/roll/roll-dialog.mjs b/module/roll/roll-dialog.mjs index fe80690d..6e8b824c 100644 --- a/module/roll/roll-dialog.mjs +++ b/module/roll/roll-dialog.mjs @@ -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)) diff --git a/module/roll/roll-part-action.mjs b/module/roll/roll-part-action.mjs index c52773e2..28001700 100644 --- a/module/roll/roll-part-action.mjs +++ b/module/roll/roll-part-action.mjs @@ -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) { diff --git a/module/roll/roll-type-attaque.mjs b/module/roll/roll-type-attaque.mjs index 794e8fb8..0e4a313a 100644 --- a/module/roll/roll-type-attaque.mjs +++ b/module/roll/roll-type-attaque.mjs @@ -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) } diff --git a/module/roll/roll-type-comp.mjs b/module/roll/roll-type-comp.mjs index 8ab56bca..169fb484 100644 --- a/module/roll/roll-type-comp.mjs +++ b/module/roll/roll-type-comp.mjs @@ -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" } diff --git a/module/roll/roll-type-defense.mjs b/module/roll/roll-type-defense.mjs index 11bc23e7..7565e66a 100644 --- a/module/roll/roll-type-defense.mjs +++ b/module/roll/roll-type-defense.mjs @@ -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 } diff --git a/module/roll/roll-type-jeu.mjs b/module/roll/roll-type-jeu.mjs index 96a0fe73..705c6adc 100644 --- a/module/roll/roll-type-jeu.mjs +++ b/module/roll/roll-type-jeu.mjs @@ -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` diff --git a/module/roll/roll-type-possession.mjs b/module/roll/roll-type-possession.mjs index 305df461..bf9cb174 100644 --- a/module/roll/roll-type-possession.mjs +++ b/module/roll/roll-type-possession.mjs @@ -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) } diff --git a/module/roll/roll-type-tache.mjs b/module/roll/roll-type-tache.mjs index 7c38437d..c0ab5f3e 100644 --- a/module/roll/roll-type-tache.mjs +++ b/module/roll/roll-type-tache.mjs @@ -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) { diff --git a/module/roll/roll-type.mjs b/module/roll/roll-type.mjs index 5d4a6364..4d57c03f 100644 --- a/module/roll/roll-type.mjs +++ b/module/roll/roll-type.mjs @@ -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) {