Fix: détermination niveau de base

simplification: déterminer les catégories en fonction du type d'Item
This commit is contained in:
2024-09-27 22:39:49 +02:00
parent 599fdc752d
commit 9c17f85fa8
5 changed files with 26 additions and 27 deletions

View File

@ -1,4 +1,5 @@
import { Grammar } from "./grammar.js";
import { RdDItem } from "./item.js";
import { Misc } from "./misc.js";
const competenceTroncs = [["Esquive", "Dague", "Corps à corps"],
@ -23,12 +24,12 @@ const limitesArchetypes = [
];
/* -------------------------------------------- */
const categoriesCompetences = {
export const CATEGORIES_COMPETENCES = {
"generale": { base: -4, label: "Générales" },
"particuliere": { base: -8, label: "Particulières" },
"specialisee": { base: -11, label: "Spécialisées" },
"connaissance": { base: -11, label: "Connaissances" },
"draconic": { base: -11, label: "Draconics" },
"draconic": { base: -11, label: "Draconic" },
"melee": { base: -6, label: "Mêlée" },
"tir": { base: -8, label: "Tir" },
"lancer": { base: -8, label: "Lancer" }
@ -48,16 +49,14 @@ function _buildCumulXP() {
const competence_xp_cumul = _buildCumulXP();
export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static getCategories() {
return categoriesCompetences;
}
/* -------------------------------------------- */
static getLabelCategorie(category) {
return categoriesCompetences[category].label;
return CATEGORIES_COMPETENCES[category].label;
}
/* -------------------------------------------- */
static getNiveauBase(category, categories = categoriesCompetences) {
/* -------------------------------------------- */
static getNiveauBase(category, itemType) {
let categories = RdDItem.getCategories(itemType)
return categories[category]?.base ?? 0;
}
@ -191,7 +190,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static isNiveauBase(item) {
return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.getCategories());
return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.type);
}
/* -------------------------------------------- */