Item arme, armure, competences, sorts, herbes -> OK

This commit is contained in:
sladecraven 2021-03-25 17:51:03 +01:00
parent 1616931476
commit ceb73b9944
5 changed files with 18 additions and 10 deletions

View File

@ -55,29 +55,34 @@ const competence_xp_cumul = _buildCumulXP();
export class RdDItemCompetence extends Item { export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static actorCompendium(actorType) { static actorCompendium(actorType) {
return compendiumCompetences[actorType]; return compendiumCompetences[actorType];
} }
/* -------------------------------------------- */
static getCategorieCompetences() { static getCategorieCompetences() {
return categorieCompetences; return categorieCompetences;
} }
/* -------------------------------------------- */
static getNiveauBase(category) { static getNiveauBase(category) {
return categorieCompetences[category].level; return categorieCompetences[category].base;
} }
/* -------------------------------------------- */
static getLabelCategorie(category) { static getLabelCategorie(category) {
return categorieCompetences[category].label; return categorieCompetences[category].label;
} }
/* -------------------------------------------- */
static getEsquive(competences) { static getEsquive(competences) {
return { name: 'Esquive', niveau: RdDItemCompetence.findCompetence(competences, 'Esquive')?.data.niveau ?? -6 }; return { name: 'Esquive', niveau: RdDItemCompetence.findCompetence(competences, 'Esquive')?.data.niveau ?? -6 };
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isCompetenceArme(competence) { static isCompetenceArme(competence) {
switch (competence.data.categorie) { switch (competence.data.data.categorie) {
case 'melee': case 'melee':
return competence.name != 'Esquive'; return competence.data.name != 'Esquive';
case 'tir': case 'tir':
case 'lancer': case 'lancer':
return true; return true;
@ -169,11 +174,13 @@ export class RdDItemCompetence extends Item {
return economie; return economie;
} }
/* -------------------------------------------- */
static levelUp(itemData) { static levelUp(itemData) {
itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau); itemData.data.xpNext = RdDItemCompetence.getCompetenceNextXp(itemData.data.niveau);
itemData.data.isLevelUp = itemData.data.xp >= itemData.data.xpNext; itemData.data.isLevelUp = itemData.data.xp >= itemData.data.xpNext;
} }
/* -------------------------------------------- */
static isVisible(itemData) { static isVisible(itemData) {
return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie); return Number(itemData.data.niveau) != RdDItemCompetence.getNiveauBase(itemData.data.categorie);
} }

View File

@ -67,6 +67,7 @@ export class RdDItemSheet extends ItemSheet {
} }
if (formData.type == 'arme') { if (formData.type == 'arme') {
formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it)); formData.competences = await RdDUtility.loadCompendium( 'foundryvtt-reve-de-dragon.competences', it => RdDItemCompetence.isCompetenceArme(it));
console.log(formData.competences);
} }
if ( formData.type == 'recettealchimique' ) { if ( formData.type == 'recettealchimique' ) {
RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id ); RdDAlchimie.processManipulation(formData.item, this.actor && this.actor.id );

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label>Compétence associée</label> <label>Compétence associée</label>
<select name="data.competence" id="competence" data-dtype="String"> <select name="data.competence" id="competence" data-dtype="String">
{{#select item.data.competence}} {{#select data.competence}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}}
{{/select}} {{/select}}
</select> </select>

View File

@ -17,7 +17,7 @@
<div class="form-group"> <div class="form-group">
<label>Catégorie </label> <label>Catégorie </label>
<select name="data.categorie" id="categorie" data-dtype="String"> <select name="data.categorie" id="categorie" data-dtype="String">
{{#select item.data.categorie}} {{#select data.categorie}}
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-competence.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/enum-categorie-competence.html"}}
{{/select}} {{/select}}
</select> </select>
@ -33,7 +33,7 @@
<div class="form-group"> <div class="form-group">
<label for="base">Niveau de base </label> <label for="base">Niveau de base </label>
<select name="data.base" id="base" data-dtype="Number"> <select name="data.base" id="base" data-dtype="Number">
{{#select item.data.base}} {{#select data.base}}
{{>"systems/foundryvtt-reve-de-dragon/templates/competence-base.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/competence-base.html"}}
{{/select}} {{/select}}
</select> </select>
@ -41,7 +41,7 @@
<div class="form-group"> <div class="form-group">
<label for="defaut_carac">Caractéristique par défaut </label> <label for="defaut_carac">Caractéristique par défaut </label>
<select name="data.defaut_carac" id="defaut_carac" data-dtype="String"> <select name="data.defaut_carac" id="defaut_carac" data-dtype="String">
{{#select item.data.defaut_carac}} {{#select data.defaut_carac}}
{{>"systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/competence-carac-defaut.html"}}
{{/select}} {{/select}}
</select> </select>

View File

@ -11,7 +11,7 @@
<div class="form-group"> <div class="form-group">
<label>Draconic </label> <label>Draconic </label>
<select name="data.draconic" id="draconic" data-dtype="String"> <select name="data.draconic" id="draconic" data-dtype="String">
{{#select item.data.draconic}} {{#select data.draconic}}
{{>"systems/foundryvtt-reve-de-dragon/templates/sort-draconic.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/sort-draconic.html"}}
{{/select}} {{/select}}
</select> </select>
@ -19,7 +19,7 @@
<div class="form-group"> <div class="form-group">
<label for="xp">Case TMR </label> <label for="xp">Case TMR </label>
<select name="data.caseTMR" id="caseTMR" data-dtype="String"> <select name="data.caseTMR" id="caseTMR" data-dtype="String">
{{#select item.data.caseTMR}} {{#select data.caseTMR}}
{{>"systems/foundryvtt-reve-de-dragon/templates/sort-tmr.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/sort-tmr.html"}}
<option value="special">Case spéciale TMR (saisie ci-dessous)</option> <option value="special">Case spéciale TMR (saisie ci-dessous)</option>
{{/select}} {{/select}}