diff --git a/module/actor.js b/module/actor.js index 0364d399..d898c7cf 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1426,34 +1426,32 @@ export class RdDActor extends Actor { /* -------------------------------------------- */ async actionRefoulement(item) { const refoulement = item?.system.refoulement ?? 0; - if (refoulement>0) { + if (refoulement > 0) { RdDConfirm.confirmer({ settingConfirmer: "confirmation-refouler", content: `

Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?

`, title: 'Confirmer la refoulement', buttonLabel: 'Refouler', onAction: async () => { - ChatMessage.create({ - whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), - content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement` - }); - await this.ajouterRefoulement(refoulement); + await this.ajouterRefoulement(refoulement, `une queue ${item.name}`); await item.delete(); } - }) + }); } } - + /* -------------------------------------------- */ - async ajouterRefoulement(value = 1) { - let refoulement = this.system.reve.refoulement.value + value; - let total = await RdDDice.rollTotal("1d20"); - if (total <= refoulement) { + async ajouterRefoulement(value = 1, refouler) { + const refoulement = this.system.reve.refoulement.value + value; + const roll = new Roll("1d20"); + await roll.evaluate({ async: true }); + await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` }); + if (roll.total <= refoulement) { refoulement = 0; await this.ajouterSouffle({ chat: true }); } await this.update({ "system.reve.refoulement.value": refoulement }); - return refoulement == 0 ? "souffle" : "none"; + return roll; } /* -------------------------------------------- */ diff --git a/module/item-competence.js b/module/item-competence.js index c2cdcb78..f61d1310 100644 --- a/module/item-competence.js +++ b/module/item-competence.js @@ -85,9 +85,9 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static getVoieDraconic(competences, voie) { return RdDItemCompetence.findFirstItem(competences, voie, { - preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), - description: 'Draconic', - }); + preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), + description: 'Draconic', + }); } /* -------------------------------------------- */ @@ -199,7 +199,7 @@ export class RdDItemCompetence extends Item { item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype); item.system.stressXpMax = 0; if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) { - item.system.stressXpMax = Math.min(xpManquant , stressTransforme); + item.system.stressXpMax = Math.min(xpManquant, stressTransforme); } } @@ -219,10 +219,10 @@ export class RdDItemCompetence extends Item { /* -------------------------------------------- */ static findCompetence(list, idOrName, options = {}) { - if (idOrName == undefined) { - return undefined; + if (idOrName == undefined || idOrName == "") { + return RdDItemCompetence.sansCompetence(); } - options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false}); + options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false }); return RdDItemCompetence.findFirstItem(list, idOrName, options); } @@ -231,6 +231,23 @@ export class RdDItemCompetence extends Item { return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' }); } + static sansCompetence() { + return { + name: "Sans compétence", + type: "competence", + img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp", + system: { + niveau: 0, + default_diffLibre: 0, + base: 0, + categorie: "Aucune", + description: "", + descriptionmj: "", + defaut_carac: "", + } + }; + } + static findFirstItem(list, idOrName, options) { return list.find(it => it.id == idOrName && options.preFilter(it)) ?? Misc.findFirstLike(idOrName, list, options); diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 53557756..5a65cc89 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -289,9 +289,8 @@ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ async refouler() { - this._tellToGM(this.actor.name + " a refoulé : " + this.currentRencontre.name); + await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1, `une rencontre ${this.currentRencontre.name}`); await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary - await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1); this.updateTokens(); console.log("-> refouler", this.currentRencontre) this.updateValuesDisplay(); @@ -300,7 +299,7 @@ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ async ignorerRencontre() { - this._tellToGM(this.actor.name + " a ignoré : " + this.currentRencontre.name); + this._tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name); await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary this.updateTokens(); this.updateValuesDisplay(); diff --git a/module/rdd-utility.js b/module/rdd-utility.js index 1e14f75c..f3db889f 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -280,7 +280,7 @@ export class RdDUtility { Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); Handlebars.registerHelper('regle-optionnelle', (option) => ReglesOptionelles.isUsing(option)); - + Handlebars.registerHelper('trier', competences => competences.sort((a, b) => a.name.localeCompare(b.name))); Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.system.isVisible) .sort((a, b) => { if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { diff --git a/styles/img/apercu.webp b/styles/img/apercu.webp new file mode 100644 index 00000000..91a52a71 Binary files /dev/null and b/styles/img/apercu.webp differ diff --git a/styles/simple.css b/styles/simple.css index 816b58cf..c5defb15 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1583,7 +1583,7 @@ display: inline-flex; padding: 3px; } -.tooltip .ttt-xp { +.tooltip :is(.ttt-xp,.ttt-levelup) { width: 250px; background: rgba(220,220,210,0.95) !important; border-radius: 6px; diff --git a/system.json b/system.json index 91b40054..69eabbe7 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "10.0.31", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.31.zip", + "version": "10.0.32", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.32.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "compatibility": { "minimum": "10", @@ -353,7 +353,7 @@ }, { "type": "screenshot", - "url": "http://www.lahiette.com/leratierbretonnien/wp-content/uploads/2020/11/Screenshot_20201128_181102.webp", + "url": "systems/foundryvtt-reve-de-dragon/styles/img/apercu.webp", "caption": "Capture d'écran de Rêve de Dragon sur Foundry" } ] diff --git a/template.json b/template.json index 2f567bc6..d25dfcbd 100644 --- a/template.json +++ b/template.json @@ -746,9 +746,9 @@ "carac": "", "competence": "", "periodicite": "", - "fatigue": 0, + "fatigue": 1, "difficulte": 0, - "points_de_tache": 0, + "points_de_tache": 4, "points_de_tache_courant": 0, "nb_jet_echec": 0, "nb_jet_succes": 0, diff --git a/templates/actor/carac-main.html b/templates/actor/carac-main.html index d3fb3aaa..74590d5c 100644 --- a/templates/actor/carac-main.html +++ b/templates/actor/carac-main.html @@ -11,13 +11,13 @@