Merge branch 'master-fixes' into 'master'

Fix expérience carac

See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!179
This commit is contained in:
Leratier Bretonnien 2021-03-27 13:54:53 +00:00
commit 3582fa9c8a
2 changed files with 4 additions and 4 deletions

View File

@ -1688,11 +1688,11 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async _appliquerAjoutExperience(rollData, display = true) {
if (!this.isPersonnage()) return;
let xpResult = this.appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
let xpResult = await this.appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence);
if (display && xpResult.result) {
let xpmsg = "<br>Points d'expérience gagnés ! Carac: " + xpResult.xpCarac + ", Comp: " + xpResult.xpCompetence;
let message = {
whisher: ChatMessage.getWhisperRecipients(["GM", this.name]),
whisher: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: "<strong>" + rollData.selectedCarac.label + "</strong>" + xpmsg,
}
ChatMessage.create(message);
@ -2282,7 +2282,7 @@ export class RdDActor extends Actor {
async chanceActuelleIncDec(value, limit = true) {
let chance = Math.max(Misc.templateData(this).compteurs.chance.value + value, 0);
if (limit) {
chance = Math.min(chance.value, this.getChance())
chance = Math.min(chance, this.getChance())
}
await this.updateCompteurValue("chance", chance);
}

View File

@ -40,7 +40,7 @@ export class RdDCarac {
/* -------------------------------------------- */
static findCarac(carac, name) {
name = Grammar.toLowerCaseNoAccent(name);
const pairs = Object.entries(carac)
.filter(([key, value]) => key.includes(name) || Grammar.toLowerCaseNoAccent(value.label).includes(name));