diff --git a/module/actor-sheet.js b/module/actor-sheet.js
index fbad5d0b..e2f6c4fe 100644
--- a/module/actor-sheet.js
+++ b/module/actor-sheet.js
@@ -20,7 +20,8 @@ export class RdDActorSheet extends ActorSheet {
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}],
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}],
editCaracComp: false,
- cacherCompetencesNiveauBase: false,
+ montrerCompetencesNiveauBase: false,
+ montrerArchetype: false
});
}
@@ -28,17 +29,13 @@ export class RdDActorSheet extends ActorSheet {
getData() {
let data = super.getData();
- // Gestion du lock/unlock des zones éditables (carac+compétences)
data.data.editCaracComp = this.options.editCaracComp;
- data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Débloquer";
- data.data.lockUnlockIcon = (this.options.editCaracComp) ? "unlocked.svg" : "locked.svg";
- // Gestion de l'affichage total/partiel des compétences
- data.data.cacherCompetencesNiveauBase = this.options.cacherCompetencesNiveauBase;
- data.data.showHideCompetenceText = (this.options.cacherCompetencesNiveauBase) ? "Montrer tout" : "Filtrer" ;
- data.data.showHideCompetenceIcon = (this.options.cacherCompetencesNiveauBase) ? "no-filter.svg" : "filter.svg";
+ data.data.montrerCompetencesNiveauBase = this.options.montrerCompetencesNiveauBase;
+ data.data.montrerArchetype = this.options.montrerArchetype;
let compCategorieNiveau = RdDUtility.getLevelCategory(); // recup catégorie
data.itemsByType = RdDUtility.buildItemsClassification(data.items);
+
// Competence per category
data.competenceByCategory = {};
let competenceXPTotal = 0;
@@ -54,7 +51,7 @@ export class RdDActorSheet extends ActorSheet {
if (!RdDUtility.isTronc( item.name ) ) // Ignorer les compétences 'troncs' à ce stade
competenceXPTotal += RdDUtility.computeCompetenceXPCost(item);
item.data.afficherCompetence = true;
- if ( data.data.cacherCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) {
+ if ( data.data.montrerCompetencesNiveauBase && (Number(item.data.niveau) == Number(compCategorieNiveau[item.data.categorie]) ) ) {
item.data.afficherCompetence = false;
}
list.push(item);
@@ -170,31 +167,6 @@ export class RdDActorSheet extends ActorSheet {
d.render(true);
}
- /* -------------------------------------------- */
- afficheResumeArchetype() {
- let levelCategory = RdDUtility.getLevelCategory();
- let labelCategory = RdDUtility.getLabelCategory();
- let contentHTML = "";
- for (let compCategory in this.competenceByCategory) {
- console.log(">>>>", compCategory);
- contentHTML += "
" + labelCategory[compCategory] + "";
- for (let comp of this.competenceByCategory[compCategory]) {
- if ( !comp.data.niveau_archetype ) comp.data.niveau_archetype = levelCategory[compCategory];
- contentHTML += "
" + comp.name + " : " + comp.data.niveau_archetype;
- }
- }
- let dialogData = {
- content: contentHTML,
- buttons: {
- one: {
- icon: '',
- label: "Fermer"
- }
- }
- }
- new Dialog( dialogData ).render(true);
- }
-
/* -------------------------------------------- */
async createEmptyTache( ) {
await this.actor.createOwnedItem( { name: 'Nouvelle tache', type: 'tache'}, { renderSheet: true } );
@@ -419,6 +391,11 @@ export class RdDActorSheet extends ActorSheet {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCompetenceXP( compName, parseInt(event.target.value) );
} );
+ // On competence archetype change
+ html.find('.competence-archetype').change((event) => {
+ let compName = event.currentTarget.attributes.compname.value;
+ this.actor.updateCompetenceArchetype( compName, parseInt(event.target.value) );
+ } );
}
// Gestion du bouton lock/unlock
@@ -426,8 +403,12 @@ export class RdDActorSheet extends ActorSheet {
this.options.editCaracComp = !this.options.editCaracComp;
this.render(true);
});
- html.find('.show-hide-competences').click((event) => {
- this.options.cacherCompetencesNiveauBase = !this.options.cacherCompetencesNiveauBase;
+ html.find('#show-hide-competences').click((event) => {
+ this.options.montrerCompetencesNiveauBase = !this.options.montrerCompetencesNiveauBase;
+ this.render(true);
+ });
+ html.find('#show-hide-archetype').click((event) => {
+ this.options.montrerArchetype = !this.options.montrerArchetype;
this.render(true);
});
@@ -458,12 +439,6 @@ export class RdDActorSheet extends ActorSheet {
html.find('#ethylisme').change((event) => {
this.actor.setEthylisme(parseInt(event.target.value) );
} );
-
- // Dialog d'archetype
- html.find("#affiche-archetype").click((event) => {
- this.afficheResumeArchetype()
- } );
-
html.find('#stress-test').click((event) => {
this.actor.stressTest();
this.render(true);
diff --git a/module/actor.js b/module/actor.js
index 6b2ec179..5d08602a 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -611,6 +611,18 @@ export class RdDActor extends Actor {
console.log("Competence not found", compName);
}
}
+
+ /* -------------------------------------------- */
+ async updateCompetenceArchetype( compName, compValue )
+ {
+ let comp = this.getCompetence(compName);
+ if ( comp ) {
+ const update = {_id: comp._id, 'data.niveau_archetype': compValue };
+ const updated = await this.updateEmbeddedEntity("OwnedItem", update); // Updates one EmbeddedEntity
+ } else {
+ console.log("Competence not found", compName);
+ }
+ }
/* -------------------------------------------- */
async updateCompteurValue( fieldName, fieldValue )
diff --git a/module/rdd-bonus.js b/module/rdd-bonus.js
index 6276c514..e5b7c156 100644
--- a/module/rdd-bonus.js
+++ b/module/rdd-bonus.js
@@ -84,7 +84,7 @@ export class RdDBonus {
/* -------------------------------------------- */
static _dmgParticuliere(rollData) {
- return rollData.particuliereAttaque == 'force' ? 5 : 0;
+ return rollData.particuliere == 'force' ? 5 : 0;
}
}
\ No newline at end of file
diff --git a/module/rdd-combat.js b/module/rdd-combat.js
index dd9e37b2..0ffc6d09 100644
--- a/module/rdd-combat.js
+++ b/module/rdd-combat.js
@@ -247,7 +247,7 @@ export class RdDCombat {
rollData.show = {
cible: this.target ? this.defender.data.name : 'la cible',
- isRecul: (rollData.particuliereAttaque == 'force' || rollData.tactique == 'charge')
+ isRecul: (rollData.particuliere == 'force' || rollData.tactique == 'charge')
}
await RdDResolutionTable.displayRollData(rollData, this.attacker.name, 'chat-resultat-attaque.html');
@@ -299,17 +299,17 @@ export class RdDCombat {
/* -------------------------------------------- */
_filterArmesParade(items, competence) {
- let itemsEquipped = items.filter(item => item.data.equipe == true );
+ items = items.filter(item => item.data.equipe == true );
switch (competence.data.categorie) {
case 'tir':
case 'lancer':
- return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers')
+ return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
default:
// Le fléau ne peut être paré qu’au bouclier p115
if (competence.name == "Fléau"){
- return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers')
+ return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
}
- return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped));
+ return items.filter(item => RdDItemArme.getCategorieParade(item));
}
}
@@ -336,7 +336,7 @@ export class RdDCombat {
/* -------------------------------------------- */
async choixParticuliere(rollData, choix) {
console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
- rollData.particuliereAttaque = choix;
+ rollData.particuliere = choix;
await this._onAttaqueNormale(rollData);
}
@@ -404,7 +404,7 @@ export class RdDCombat {
}
static isAttaqueFinesse(attackerRoll) {
- return attackerRoll && attackerRoll.particuliereAttaque == 'finesse';
+ return attackerRoll && attackerRoll.particuliere == 'finesse';
}
needParadeSignificative(attackerRoll, armeParade) {
@@ -555,7 +555,7 @@ export class RdDCombat {
// Est-ce une parade normale?
if (rollData.arme && attackerRoll && !rollData.rolled.isPart) {
// Est-ce que l'attaque est une particulière en force ou une charge
- if (rollData.needResist || attackerRoll.particuliereAttaque == 'force' || attackerRoll.tactique == 'charge') {
+ if (rollData.needResist || attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge') {
rollData.show = rollData.show || {}
@@ -621,7 +621,7 @@ export class RdDCombat {
}
_isAttaqueCauseRecul(attaque) {
- return attaque.particuliereAttaque == 'force' || attaque.tactique == 'charge';
+ return attaque.particuliere == 'force' || attaque.tactique == 'charge';
}
_computeImpactRecul(attaque) {
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 8c939dc3..69d65567 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -431,6 +431,9 @@ export class RdDUtility {
xp += competence_xp_par_niveau[i+10];
//console.log(i, i+10, competence_xp_par_niveau[i+10]);
}
+ if (competence.data.categorie == 'draconic') {
+ xp+= competence.data.xp_sort;
+ }
return xp;
}
diff --git a/templates/actor-creature-sheet.html b/templates/actor-creature-sheet.html
index d1e16dae..46aa3029 100644
--- a/templates/actor-creature-sheet.html
+++ b/templates/actor-creature-sheet.html
@@ -101,12 +101,12 @@
{{#each data.competencecreature as |comp key|}}