Tâches sans compétences
This commit is contained in:
parent
269b4ec0ca
commit
f1d7cfa1f8
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -16,6 +16,7 @@
|
||||
<label for="xp">Compétence</label>
|
||||
<select name="system.competence" id="competenceselect" data-dtype="String">
|
||||
{{#select system.competence}}
|
||||
<option value="">Sans compétence</option>
|
||||
{{#each competences as |competence key|}}
|
||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||
{{/each}}
|
||||
|
Loading…
Reference in New Issue
Block a user