Bug fixe sort

This commit is contained in:
sladecraven 2020-12-30 11:50:18 +01:00
parent ee25775629
commit f36e8c2179
5 changed files with 31 additions and 7 deletions

View File

@ -739,7 +739,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async ajouterSouffle(options = {chat : false}) {
let souffle = RdDRollTables.getSouffle();
let souffle = await RdDRollTables.getSouffle();
await this.createOwnedItem(souffle);
if (options.chat){
ChatMessage.create({
@ -1305,7 +1305,7 @@ export class RdDActor extends Actor {
+ " pour " + sort.data.ptreve_reel + " points de Rêve"
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
let depenseReve = sort.data.ptreve_reel;
let depenseReve = Number(sort.data.ptreve_reel);
let myReve = duplicate(this.data.data.reve.reve);
if (rolled.isSuccess) { // Réussite du sort !
//sort.ptreve_reel = coutReve;
@ -1335,7 +1335,7 @@ export class RdDActor extends Actor {
}
} else {
if (rolled.isETotal) { // Echec total !
depenseReve = Math.max(myReve.value, Math.floor(depenseReve * 1.5))
depenseReve = Math.min(myReve.value, Math.floor(depenseReve * 1.5));
explications += "<br><strong>Echec TOTAL</strong> du sort : " + depenseReve + " Points de Rêve";
// TODO: mise en réserve d'un échec total...
} else {

View File

@ -372,7 +372,8 @@ export class RdDTMRDialog extends Dialog {
if (this.viewOnly) {
return;
}
let sortReserve = this.sortReserves.find(it => it.coord == coordTMR)
let sortReserve = TMRUtility.getSortReserve( this.sortReserves, coordTMR );
if (sortReserve != undefined) {
await this.actor.deleteSortReserve(sortReserve.coord);
this.updateSortReserve();

View File

@ -558,6 +558,19 @@ export class TMRUtility {
}
}
/* -------------------------------------------- */
static getSortReserve( reserveList, coordTMR ) {
// TODO : Gérer les têtes spéciales réserve!
let sortReserve
let tmrDescr = this.getTMRDescription(coordTMR);
if ( tmrDescr.type == 'fleuve') { // Gestion de la reserve en Fleuve
sortReserve = reserveList.find(it => { TMRUtility.getTMRDescription(it.coord).type == 'fleuve' } );
} else { // Reserve sur un case "normale"
sortReserve = reserveList.find(it => it.coord == coordTMR);
}
return sortReserve;
}
/* -------------------------------------------- */
/** Returns a list of case inside a given distance
*

View File

@ -5,7 +5,7 @@
"version": "1.2.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8",
"templateVersion": 72,
"templateVersion": 73,
"author": "LeRatierBretonnien",
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
"styles": ["styles/simple.css"],

View File

@ -541,7 +541,7 @@
}
},
"Item": {
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache"],
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation"],
"objet": {
"description": "",
"quantite": 1,
@ -713,6 +713,16 @@
"valeur_deniers":0,
"encombrement":0,
"description": ""
},
"meditation": {
"competence": "",
"theme": "",
"support": "",
"heure": "",
"purification": "",
"veture": "",
"comportement": "",
"tmr": ""
}
}
}