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

View File

@ -348,7 +348,7 @@ export class RdDTMRDialog extends Dialog {
} }
if (rolled.isPart) { if (rolled.isPart) {
explication += "<br>Vous avez fait une Réussite Particulière"; explication += "<br>Vous avez fait une Réussite Particulière";
this.actor._appliquerAjoutExperience({ rolled: rolled, seletedCarac: {label: 'reve'}, competence: draconic.name }) this.actor._appliquerAjoutExperience({ rolled: rolled, seletedCarac: { label: 'reve'}, competence: draconic.name })
msg2MJ += "<br>Et a fait une réussite particulière"; msg2MJ += "<br>Et a fait une réussite particulière";
} }
@ -372,7 +372,8 @@ export class RdDTMRDialog extends Dialog {
if (this.viewOnly) { if (this.viewOnly) {
return; return;
} }
let sortReserve = this.sortReserves.find(it => it.coord == coordTMR)
let sortReserve = TMRUtility.getSortReserve( this.sortReserves, coordTMR );
if (sortReserve != undefined) { if (sortReserve != undefined) {
await this.actor.deleteSortReserve(sortReserve.coord); await this.actor.deleteSortReserve(sortReserve.coord);
this.updateSortReserve(); 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 /** Returns a list of case inside a given distance
* *

View File

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

View File

@ -541,7 +541,7 @@
} }
}, },
"Item": { "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": { "objet": {
"description": "", "description": "",
"quantite": 1, "quantite": 1,
@ -713,6 +713,16 @@
"valeur_deniers":0, "valeur_deniers":0,
"encombrement":0, "encombrement":0,
"description": "" "description": ""
},
"meditation": {
"competence": "",
"theme": "",
"support": "",
"heure": "",
"purification": "",
"veture": "",
"comportement": "",
"tmr": ""
} }
} }
} }