Cleanup: gererExperience=>ajoutExperience

This commit is contained in:
2026-03-24 20:45:54 +01:00
parent d80efba092
commit 4141eeaa4a
7 changed files with 16 additions and 37 deletions
+4 -24
View File
@@ -1433,7 +1433,7 @@ export class RdDActor extends RdDBaseActorSang {
} }
await RdDResolutionTable.rollData(ethylismeData.jetVie); await RdDResolutionTable.rollData(ethylismeData.jetVie);
this.gererExperience(ethylismeData.jetVie); this.ajoutExperience(ethylismeData.jetVie);
RollDataAjustements.calcul(ethylismeData.jetVie, this); RollDataAjustements.calcul(ethylismeData.jetVie, this);
if (ethylismeData.jetVie.rolled.isSuccess) { if (ethylismeData.jetVie.rolled.isSuccess) {
ethylisme.nb_doses++; ethylisme.nb_doses++;
@@ -1465,7 +1465,7 @@ export class RdDActor extends RdDBaseActorSang {
finalLevel: Number(ethylisme.value) + Number(this.system.compteurs.moral.value) finalLevel: Number(ethylisme.value) + Number(this.system.compteurs.moral.value)
} }
await RdDResolutionTable.rollData(ethylismeData.jetVolonte); await RdDResolutionTable.rollData(ethylismeData.jetVolonte);
this.gererExperience(ethylismeData.jetVolonte); this.ajoutExperience(ethylismeData.jetVolonte);
RollDataAjustements.calcul(ethylismeData.jetVolonte, this); RollDataAjustements.calcul(ethylismeData.jetVolonte, this);
} }
} }
@@ -1560,21 +1560,6 @@ export class RdDActor extends RdDBaseActorSang {
return 0; return 0;
} }
/* -------------------------------------------- */
createCallbackExperience() {
return {
action: r => this.appliquerAjoutExperience(r)
};
}
/* -------------------------------------------- */
createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
return {
action: r => this.appliquerAppelMoral(r)
};
}
/* -------------------------------------------- */ /* -------------------------------------------- */
isCaracMax(code) { isCaracMax(code) {
return RdDItemRace.isRacialMax(this, code) return RdDItemRace.isRacialMax(this, code)
@@ -1639,7 +1624,7 @@ export class RdDActor extends RdDBaseActorSang {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { async ajoutExperience(rollData, hideChatMessage = 'show') {
if (!rollData.rolled.isPart || if (!rollData.rolled.isPart ||
rollData.finalLevel >= 0 || rollData.finalLevel >= 0 ||
game.settings.get("core", "rollMode") == 'selfroll' || game.settings.get("core", "rollMode") == 'selfroll' ||
@@ -1891,16 +1876,11 @@ export class RdDActor extends RdDBaseActorSang {
}; };
RollDataAjustements.calcul(rollData, this); RollDataAjustements.calcul(rollData, this);
await RdDResolutionTable.rollData(rollData); await RdDResolutionTable.rollData(rollData);
this.gererExperience(rollData); this.ajoutExperience(rollData);
await RdDRollResult.displayRollData(rollData, this) await RdDRollResult.displayRollData(rollData, this)
return rollData.rolled; return rollData.rolled;
} }
/* -------------------------------------------- */
gererExperience(rollData) {
this.createCallbackExperience().action(rollData);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async creerTacheDepuisLivre(item, options = { renderSheet: true }) { async creerTacheDepuisLivre(item, options = { renderSheet: true }) {
const nomTache = "Lire " + item.name; const nomTache = "Lire " + item.name;
+6 -8
View File
@@ -26,7 +26,7 @@ import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, CATEGORIES_COMPETENCES_CREATURES } fr
import { RollDataAjustements } from "../rolldata-ajustements-v1.js"; import { RollDataAjustements } from "../rolldata-ajustements-v1.js";
import { MappingCreatureArme } from "../item/mapping-creature-arme.mjs"; import { MappingCreatureArme } from "../item/mapping-creature-arme.mjs";
import RollDialog from "../roll/roll-dialog.mjs"; import RollDialog from "../roll/roll-dialog.mjs";
import { ATTAQUE_ROLL_TYPES, DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE } from "../roll/roll-constants.mjs"; import { DEFAULT_ROLL_TYPES, DIFF, ROLL_TYPE_ATTAQUE } from "../roll/roll-constants.mjs";
import { OptionsAvancees, ROLL_DIALOG_V2 } from "../settings/options-avancees.js"; import { OptionsAvancees, ROLL_DIALOG_V2 } from "../settings/options-avancees.js";
import { PART_COMP } from "../roll/roll-part-comp.mjs"; import { PART_COMP } from "../roll/roll-part-comp.mjs";
import { RdDInitiative } from "../initiative.mjs"; import { RdDInitiative } from "../initiative.mjs";
@@ -154,7 +154,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
async computeArmure(dmg) { return this.getProtectionNaturelle() } async computeArmure(dmg) { return this.getProtectionNaturelle() }
async remiseANeuf() { } async remiseANeuf() { }
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { } async ajoutExperience(rollData, hideChatMessage = 'show') { }
computeResumeBlessure() { } computeResumeBlessure() { }
countBlessures(filter = it => !it.isContusion()) { return 0 } countBlessures(filter = it => !it.isContusion()) { return 0 }
@@ -295,7 +295,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
/* -------------------------------------------- */ /* -------------------------------------------- */
createCallbackExperience() { createCallbackExperience() {
return { action: r => this.appliquerAjoutExperience(r) } return { action: r => this.ajoutExperience(r) }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@@ -304,7 +304,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
return { action: r => this.appliquerAppelMoral(r) } return { action: r => this.appliquerAppelMoral(r) }
} }
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { } async ajoutExperience(rollData, hideChatMessage = 'show') { }
async appliquerAppelMoral(rollData) { } async appliquerAppelMoral(rollData) { }
async _onCloseRollDialog(html) { } async _onCloseRollDialog(html) { }
@@ -371,13 +371,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
} }
RollDataAjustements.calcul(rollData, this); RollDataAjustements.calcul(rollData, this);
await RdDResolutionTable.rollData(rollData); await RdDResolutionTable.rollData(rollData);
this.gererExperience(rollData); this.ajoutExperience(rollData);
await RdDResolutionTable.displayRollData(rollData, this) await RdDResolutionTable.displayRollData(rollData, this)
return rollData.rolled; return rollData.rolled;
} }
gererExperience(rollData) { }
/* -------------------------------------------- */ /* -------------------------------------------- */
async roll() { async roll() {
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) { if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
@@ -727,7 +725,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
} }
await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs') await RdDRollResult.displayRollData(rollData, this, 'chat-resultat-accorder-cauchemar.hbs')
await this.appliquerAjoutExperience(rollData, true) await this.ajoutExperience(rollData, true)
return rolled.isSuccess; return rolled.isSuccess;
} }
+1 -1
View File
@@ -107,7 +107,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
async computeArmure(attackerRoll) { return this.getProtectionNaturelle() } async computeArmure(attackerRoll) { return this.getProtectionNaturelle() }
async remiseANeuf() { } async remiseANeuf() { }
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { } async ajoutExperience(rollData, hideChatMessage = 'show') { }
/* -------------------------------------------- */ /* -------------------------------------------- */
+1
View File
@@ -874,6 +874,7 @@ export class RdDBaseActor extends Actor {
ui.notifications.info(`${this.getAlias()} ne peut pas faire cette action: ${action}`) ui.notifications.info(`${this.getAlias()} ne peut pas faire cette action: ${action}`)
} }
ajoutExperience(rollData) { }
isAlcoolise() { return false } isAlcoolise() { return false }
async jetEthylisme() { this.actionImpossible("jet d'éthylisme") } async jetEthylisme() { this.actionImpossible("jet d'éthylisme") }
async rollAppelChance() { this.actionImpossible("appel à la chance") } async rollAppelChance() { this.actionImpossible("appel à la chance") }
+2 -2
View File
@@ -380,7 +380,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
this.rollData = rollData this.rollData = rollData
this.rollOptions = { this.rollOptions = {
callbacks: [ callbacks: [
async r => await r.active.actor.appliquerAjoutExperience(r), async r => await r.active.actor.ajoutExperience(r),
async r => await r.active.actor.appliquerAppelMoral(r), async r => await r.active.actor.appliquerAppelMoral(r),
...(rollOptions.callbacks ?? []) ...(rollOptions.callbacks ?? [])
], ],
@@ -569,7 +569,7 @@ export default class RollDialog extends HandlebarsApplicationMixin(ApplicationV2
} }
async defaultCallback(roll, rolled) { async defaultCallback(roll, rolled) {
await roll.active.actor.appliquerAjoutExperience(roll) await roll.active.actor.ajoutExperience(roll)
await roll.active.actor.appliquerAppelMoral(roll) await roll.active.actor.appliquerAppelMoral(roll)
} }
+1 -1
View File
@@ -359,7 +359,7 @@ export class RdDCalendrier extends Application {
// Gestion expérience (si existante) // Gestion expérience (si existante)
request.competence = actor.getCompetence('Astrologie') request.competence = actor.getCompetence('Astrologie')
request.selectedCarac = actor.system.carac["vue"]; request.selectedCarac = actor.system.carac["vue"];
actor.appliquerAjoutExperience(request, 'hide'); actor.ajoutExperience(request, 'hide');
} }
} }
else { else {
+1 -1
View File
@@ -125,7 +125,7 @@ export class EffetsRencontre {
} }
static experience_particuliere = async (dialog, context) => { static experience_particuliere = async (dialog, context) => {
await context.actor.appliquerAjoutExperience(context) await context.actor.ajoutExperience(context)
} }
static regain_seuil = async (dialog, context) => { static regain_seuil = async (dialog, context) => {