diff --git a/module/system/dialogs/groupLearningDialog.mjs b/module/system/dialogs/groupLearningDialog.mjs index e8f080c..c70ca9f 100644 --- a/module/system/dialogs/groupLearningDialog.mjs +++ b/module/system/dialogs/groupLearningDialog.mjs @@ -179,6 +179,9 @@ export default class GroupLearningDialog extends HandlebarsApplicationMixin(foun return 'VERMINE.error_group_reserve_max'; } if (c.type === 'ability') { + if (!c.key) { + return 'VERMINE.no_group_ability'; + } const ability = c.key ? actor.items.get(c.key) : null; const requiredLevel = ability?.system?.level?.value ?? 1; if (ability && (actor.system?.level?.value || 1) < requiredLevel) { @@ -220,14 +223,16 @@ export default class GroupLearningDialog extends HandlebarsApplicationMixin(foun const required = 1 + c.handicap; if ((roll._total ?? 0) >= required) { - await this.#applySuccess(c, spent); + await this.#applySuccess(c); } + // Les Dés d'Expérience sont perdus que le jet soit réussi ou raté. + await actor.update({ "system.experience.dice": Math.max(0, (actor.system.experience.dice || 0) - spent) }); this.close(); } - async #applySuccess(c, spent) { + async #applySuccess(c) { const actor = this.#actor; - const updates = { 'system.experience.dice': (actor.system.experience.dice || 0) - spent }; + const updates = {}; if (c.type === 'level') { const current = actor.system.level.value || 1; updates['system.level.value'] = Math.min(10, current + 1); diff --git a/module/system/dialogs/learningDialog.mjs b/module/system/dialogs/learningDialog.mjs index 4aa1b2d..0acb372 100644 --- a/module/system/dialogs/learningDialog.mjs +++ b/module/system/dialogs/learningDialog.mjs @@ -132,7 +132,11 @@ export default class LearningDialog extends HandlebarsApplicationMixin(foundry.a } #totemCapacityCounts() { - const items = (this.#actor.itemTypes?.ability || []).filter(i => i.system?.type === "character" && i.system?.learned); + // Ne comptabilise que les Capacités du Totem courant du personnage + // (les Capacités liées à un autre Totem ne bloquent pas les limites). + const totem = this.#actor.system?.identity?.totem; + const items = (this.#actor.itemTypes?.ability || []).filter(i => + i.system?.type === "character" && i.system?.learned && i.system?.totem === totem); const byLevel = { 1: 0, 2: 0, 3: 0 }; for (const i of items) { const level = i.system?.level?.value || 0;