Ameliorations lancer de sort
This commit is contained in:
parent
be796a7169
commit
d24b9c07fa
@ -275,7 +275,7 @@ export class RdDActor extends Actor {
|
||||
getBestDraconic() {
|
||||
const list = this.getDraconicList().sort((a, b) => b.data.niveau - a.data.niveau);
|
||||
if (list.length == 0) {
|
||||
return { name: "none", niveau: -11 };
|
||||
return { name: "none", data: { niveau: -11 } };
|
||||
}
|
||||
return duplicate(list[0]);
|
||||
}
|
||||
@ -926,7 +926,7 @@ export class RdDActor extends Actor {
|
||||
if (item.data.quantite == undefined) item.data.quantite = 1; // Auto-fix
|
||||
if (item.data.cout < 0) item.data.cout = 0; // Auto-fix
|
||||
prixTotalEquipement += Number(item.data.cout) * Number(item.data.quantite);
|
||||
console.log("cout équipement : ", item.name, item.data.cout, item.data.quantite, prixTotalEquipement);
|
||||
//console.log("cout équipement : ", item.name, item.data.cout, item.data.quantite, prixTotalEquipement);
|
||||
}
|
||||
}
|
||||
// Mise à jour valeur totale de l'équipement
|
||||
@ -1627,6 +1627,46 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
filterSortList(sortList, coord) {
|
||||
let tmr = TMRUtility.getTMRDescription( coord);
|
||||
let letfilteredList = []
|
||||
for ( let sort of sortList) {
|
||||
if (sort.data.caseTMR.toLowerCase().includes('variable') ) {
|
||||
letfilteredList.push( sort);
|
||||
} else if (sort.data.caseTMRspeciale.toLowerCase().includes('variable') ) {
|
||||
letfilteredList.push( sort);
|
||||
} else if (sort.data.caseTMR.toLowerCase() == tmr.type ) {
|
||||
letfilteredList.push( sort);
|
||||
} else if ( sort.data.caseTMR.toLowerCase().includes('spéciale') && sort.data.caseTMRspeciale.toLowerCase().includes( coord.toLowerCase() ) ) {
|
||||
letfilteredList.push( sort);
|
||||
}
|
||||
}
|
||||
|
||||
return letfilteredList;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
filterDraconicList(sortList ) {
|
||||
let draconicDone = {};
|
||||
let newDraconicList = [];
|
||||
let draconicList = this.getDraconicList();
|
||||
let bestDraconic = this.getBestDraconic();
|
||||
for ( let sort of sortList) {
|
||||
let voie = sort.data.draconic.toLowerCase();
|
||||
let competenceVoie = draconicList.find(item => item.data.categorie == 'draconic' && item.name.toLowerCase().includes( voie ) );
|
||||
if ( sort.name.toLowerCase().includes('aura') ) {
|
||||
competenceVoie = bestDraconic;
|
||||
}
|
||||
if (!draconicDone[competenceVoie.name]) {
|
||||
newDraconicList.push( competenceVoie );
|
||||
draconicDone[competenceVoie.name] = newDraconicList.length-1; // Patch local pour relier facilement voie/compétence
|
||||
}
|
||||
sort.data.listIndex = draconicDone[competenceVoie.name] || 0;
|
||||
}
|
||||
return newDraconicList;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollUnSort(coord) {
|
||||
let sortList = duplicate(this.getSortList()); // Duplication car les pts de reve sont modifiés dans le sort
|
||||
@ -1634,11 +1674,17 @@ export class RdDActor extends Actor {
|
||||
ui.notifications.info("Aucun sort disponible!");
|
||||
return;
|
||||
}
|
||||
sortList = this.filterSortList(sortList, coord);
|
||||
if (!sortList || sortList.length == 0) {
|
||||
ui.notifications.info("Aucun sort disponible pour cette case !");
|
||||
return;
|
||||
}
|
||||
if (this.currentTMR) this.currentTMR.minimize(); // Hide
|
||||
|
||||
let draconicList = this.filterDraconicList(sortList);
|
||||
let rollData = {
|
||||
selectedCarac: this.data.data.carac.reve,
|
||||
draconicList: this.getDraconicList(),
|
||||
draconicList: draconicList,
|
||||
sortList: sortList,
|
||||
competence: this.getBestDraconic(),
|
||||
selectedSort: sortList[0],
|
||||
|
@ -120,6 +120,9 @@ export class RdDRoll extends Dialog {
|
||||
rollData.selectedCarac = rollData.carac[rollData.competence.data.defaut_carac];
|
||||
$("#carac").val(rollData.competence.data.defaut_carac);
|
||||
}
|
||||
if (rollData.selectedSort) {
|
||||
$("#draconic").val( rollData.selectedSort.data.listIndex ); // Uniquement a la selection du sort, pour permettre de changer
|
||||
}
|
||||
RdDItemSort.setCoutReveReel(rollData.selectedSort);
|
||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||
$("#diffConditions").val(Misc.toInt(rollData.diffConditions));
|
||||
@ -153,6 +156,7 @@ export class RdDRoll extends Dialog {
|
||||
this.rollData.selectedSort = this.rollData.sortList[sortKey]; // Update the selectedCarac
|
||||
this.rollData.bonus = RdDItemSort.getCaseBonus(this.rollData.selectedSort, this.rollData.coord);
|
||||
RdDItemSort.setCoutReveReel(this.rollData.selectedSort);
|
||||
$("#draconic").val( this.rollData.selectedSort.data.listIndex ); // Uniquement a la selection du sort, pour permettre de changer
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#ptreve-variable').change((event) => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "1.3.7",
|
||||
"version": "1.3.8",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.9",
|
||||
|
@ -13,7 +13,7 @@
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<label for="categorie">conditions</label>
|
||||
<label for="categorie"> Conditions</label>
|
||||
<select name="diffConditions" id="diffConditions" data-dtype="number">
|
||||
{{#select diffConditions}}
|
||||
{{#each ajustementsConditions as |key|}}
|
||||
@ -28,8 +28,7 @@
|
||||
<select name="sort" id="sort" data-dtype="String">
|
||||
{{#select sort}}
|
||||
{{#each sortList as |sort key|}}
|
||||
<option value={{key}}>{{this.name}} - {{#if this.data.caseTMRspeciale}} {{this.data.caseTMRspeciale}} {{else}}{{this.data.caseTMR}}{{/if}} / R{{this.data.difficulte}} r {{sort.data.ptreve}}</option>
|
||||
|
||||
<option value={{key}}>{{this.name}} - {{#if this.data.caseTMRspeciale}} {{this.data.caseTMRspeciale}} {{else}}{{this.data.caseTMR}}{{/if}} / R{{this.data.difficulte}} r {{sort.data.ptreve}} ({{sort.data.draconic}})</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
Loading…
Reference in New Issue
Block a user