Tâches sans compétences
This commit is contained in:
parent
269b4ec0ca
commit
f1d7cfa1f8
@ -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.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype);
|
||||||
item.system.stressXpMax = 0;
|
item.system.stressXpMax = 0;
|
||||||
if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) {
|
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 = {}) {
|
static findCompetence(list, idOrName, options = {}) {
|
||||||
if (idOrName == undefined) {
|
if (idOrName == undefined || idOrName == "") {
|
||||||
return undefined;
|
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);
|
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' });
|
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) {
|
static findFirstItem(list, idOrName, options) {
|
||||||
return list.find(it => it.id == idOrName && options.preFilter(it))
|
return list.find(it => it.id == idOrName && options.preFilter(it))
|
||||||
?? Misc.findFirstLike(idOrName, list, options);
|
?? Misc.findFirstLike(idOrName, list, options);
|
||||||
|
@ -746,9 +746,9 @@
|
|||||||
"carac": "",
|
"carac": "",
|
||||||
"competence": "",
|
"competence": "",
|
||||||
"periodicite": "",
|
"periodicite": "",
|
||||||
"fatigue": 0,
|
"fatigue": 1,
|
||||||
"difficulte": 0,
|
"difficulte": 0,
|
||||||
"points_de_tache": 0,
|
"points_de_tache": 4,
|
||||||
"points_de_tache_courant": 0,
|
"points_de_tache_courant": 0,
|
||||||
"nb_jet_echec": 0,
|
"nb_jet_echec": 0,
|
||||||
"nb_jet_succes": 0,
|
"nb_jet_succes": 0,
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<label for="xp">Compétence</label>
|
<label for="xp">Compétence</label>
|
||||||
<select name="system.competence" id="competenceselect" data-dtype="String">
|
<select name="system.competence" id="competenceselect" data-dtype="String">
|
||||||
{{#select system.competence}}
|
{{#select system.competence}}
|
||||||
|
<option value="">Sans compétence</option>
|
||||||
{{#each competences as |competence key|}}
|
{{#each competences as |competence key|}}
|
||||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Loading…
Reference in New Issue
Block a user