Gestion des signes draconiques #455
@ -262,9 +262,9 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getBestDraconic() {
|
||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
||||
const list = this.getDraconicList().sort((a, b) => b.data.data.niveau - a.data.data.niveau);
|
||||
if (list.length == 0) {
|
||||
return { name: "Aucun", data: { niveau: -11 } };
|
||||
return { name: "Aucun", data: { name: "Aucun", data: { niveau: -11 } } };
|
||||
}
|
||||
return duplicate(list[0]);
|
||||
}
|
||||
@ -1742,13 +1742,14 @@ export class RdDActor extends Actor {
|
||||
let bestDraconic = this.getBestDraconic();
|
||||
for (let sort of sortList) {
|
||||
let voie = sort.data.draconic.toLowerCase();
|
||||
let draconic = draconicList.find(it => it.data.categorie == 'draconic' && it.name.toLowerCase().includes(voie));
|
||||
let draconic = draconicList.find(it => it.data.data.categorie == 'draconic' && it.data.name.toLowerCase().includes(voie));
|
||||
//console.log(draconicList, bestDraconic, draconic, voie);
|
||||
if (sort.name.toLowerCase().includes('aura')) {
|
||||
draconic = bestDraconic;
|
||||
}
|
||||
draconic = duplicate(draconic);
|
||||
if (draconicDone[draconic.name] == undefined) {
|
||||
draconic.data.defaut_carac = 'reve';
|
||||
draconic.data.data.defaut_carac = 'reve';
|
||||
newDraconicList.push(draconic);
|
||||
draconicDone[draconic.name] = newDraconicList.length - 1; // Patch local pour relier facilement voie/compétence
|
||||
}
|
||||
@ -2029,8 +2030,8 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async rollTache(id) {
|
||||
let tache = duplicate(this.getTache(id));
|
||||
let competence = duplicate(this.getCompetence(tache.data.competence));
|
||||
competence.data.defaut_carac = tache.data.carac; // Patch !
|
||||
let competence = this.getCompetence(tache.data.competence);
|
||||
competence.data.data.defaut_carac = tache.data.carac; // Patch !
|
||||
let rollData = {
|
||||
competence: competence,
|
||||
tache: tache,
|
||||
@ -2436,12 +2437,12 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSortList() {
|
||||
return this.data.items.filter(it => it.type == "sort");
|
||||
return this.data.items.filter(it => it.data.type == "sort");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDraconicList() {
|
||||
return this.data.items.filter(it => it.data.categorie == 'draconic')
|
||||
return this.data.items.filter(it => it.data.data.categorie == 'draconic')
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -3108,7 +3109,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_deleteStatusEffectsByIds(effectIds, options) {
|
||||
this.deleteEmbeddedEntity('ActiveEffect', effectIds, options);
|
||||
this.deleteEmbeddedDocument('ActiveEffect', effectIds, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -141,11 +141,12 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
function onLoad() {
|
||||
let rollData = dialog.rollData;
|
||||
console.log(rollData);
|
||||
// Update html, according to data
|
||||
if (rollData.competence) {
|
||||
// Set the default carac from the competence item
|
||||
rollData.selectedCarac = rollData.carac[rollData.competence.data.defaut_carac];
|
||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||
rollData.selectedCarac = rollData.carac[rollData.competence.data.data.defaut_carac];
|
||||
$("#carac").val(rollData.competence.data.data.defaut_carac);
|
||||
}
|
||||
if (rollData.selectedSort) {
|
||||
$("#draconic").val(rollData.selectedSort.data.listIndex); // Uniquement a la selection du sort, pour permettre de changer
|
||||
|
@ -186,7 +186,7 @@ export class EffetsDraconiques {
|
||||
}
|
||||
|
||||
static toItems(item) {
|
||||
return (item?.entity === 'Actor') ? item.data.items : (item?.entity === 'Item') ? [Misc.data(item)] : [];
|
||||
return (item?.documentName === 'Actor') ? item.data.items : (item?.documentName === 'Item') ? [Misc.data(item)] : [];
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
<div class="form-group">
|
||||
<label for="xp">Caractéristique</label>
|
||||
<select name="data.carac" id="caracselect" data-dtype="String">
|
||||
{{#select item.data.carac}}
|
||||
{{#select data.carac}}
|
||||
{{#each caracList as |carac key|}}
|
||||
<option value="{{key}}">{{carac.label}}</option>
|
||||
{{/each}}
|
||||
@ -21,7 +21,7 @@
|
||||
<div class="form-group">
|
||||
<label for="xp">Compétence</label>
|
||||
<select name="data.competence" id="competenceselect" data-dtype="String">
|
||||
{{#select item.data.competence}}
|
||||
{{#select data.competence}}
|
||||
{{#each competences as |competence key|}}
|
||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||
{{/each}}
|
||||
|
Loading…
Reference in New Issue
Block a user