Add sort
This commit is contained in:
		| @@ -8,7 +8,7 @@ import { TMRUtility } from "./tmr-utility.js"; | ||||
| export class RdDTMRDialog extends Dialog { | ||||
|    | ||||
|   /* -------------------------------------------- */   | ||||
|   constructor(sort, html, actor) { | ||||
|   constructor( html, actor, tmrData) { | ||||
|         | ||||
|     // Common conf | ||||
|     let dialogConf = {           | ||||
| @@ -30,19 +30,25 @@ export class RdDTMRDialog extends Dialog { | ||||
|     dialogOptions.height = 960; | ||||
|      | ||||
|     super(dialogConf, dialogOptions); | ||||
|          | ||||
|      | ||||
|     this.tmrdata = duplicate(tmrData);     | ||||
|     this.col1_y = 30; | ||||
|     this.col2_y = 55; | ||||
|     this.cellh  = 55; | ||||
|     this.cellw  = 55; | ||||
|     this.actor = actor; | ||||
|     this.sort  = sort; | ||||
|     this.nbFatigue = 1; // 1 premier point de fatigue du à la montée | ||||
|     this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list); | ||||
|     //console.log(this.rencontresExistantes);     | ||||
|     this.pixiApp = new PIXI.Application( {width: 720, height: 860 } );      | ||||
|          | ||||
|   } | ||||
|    | ||||
|   /* -------------------------------------------- */   | ||||
|   close() { | ||||
|     this.actor.santeIncDec("fatigue", this.nbFatigue).then( super.close() ); // moving 1 cell costs 1 fatigue | ||||
|   } | ||||
|    | ||||
|   /* -------------------------------------------- */   | ||||
|   displayPreviousRencontres() { | ||||
|     for (let rencontre of this.rencontresExistantes) { | ||||
| @@ -203,16 +209,28 @@ export class RdDTMRDialog extends Dialog { | ||||
|       let carac = this.actor.getCurrentReve(); | ||||
|       let level = draconic.data.niveau - 7; | ||||
|       let scoreDef = CONFIG.RDD.resolutionTable[carac][level+10]; | ||||
|       let myroll = new Roll("d100"); | ||||
|       myroll.roll();  | ||||
|       let result = new Roll("d100").roll().total; | ||||
|       let content = ""; | ||||
|       let mycallback; | ||||
|       console.log(">>>>", scoreDef); | ||||
|       if ( myroll.total > scoreDef.score ) { | ||||
|         content =  "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise !  Vous <strong>quittez les Terres Médianes</strong> ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score; | ||||
|       if ( result > scoreDef.score ) { | ||||
|         content =  "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise !  Vous <strong>quittez les Terres Médianes</strong> ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + result + " / " + scoreDef.score; | ||||
|         if ( result >= scoreDef.etotal ) { | ||||
|           let souffle = TMRUtility.getSouffle(true); | ||||
|           content += "<br>Vous avez fait un Echec Total. Vous subissez un Souffle de Dragon : " + souffle.name ; | ||||
|           this.actor.createOwnedItem( souffle ); | ||||
|         } | ||||
|         this.toclose = true; | ||||
|       } else { | ||||
|         content = "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score; | ||||
|         content = "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + result + " / " + scoreDef.score; | ||||
|         if ( result <= scoreDef.part ) { | ||||
|           content += "<br>Vous avez fait une Réussite Particulière"; | ||||
|           if ( level < 0 ) { | ||||
|             let xpcarac = Math.floor( Math.abs(level) / 2); | ||||
|             let xpcomp  = (Math.abs(level) % 2 == 1) ? xpcarac+1 : xpcarac; | ||||
|             content += "<br>Points d'expérience gagné ! " + xpcarac + " - " + xpcomp; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       let humideDiag = new Dialog( {title: "Case humide",  | ||||
|                   content: content,  | ||||
| @@ -272,8 +290,8 @@ export class RdDTMRDialog extends Dialog { | ||||
|       tmrPos.coord = coordTMR; | ||||
|       await myself.actor.update( { "data.reve.tmrpos": tmrPos } ); | ||||
|       myself.updateSprites(myself); | ||||
|              | ||||
|       myself.actor.santeIncDec("fatigue", 1); // moving 1 cell costs 1 fatigue | ||||
|        | ||||
|       myself.nbFatigue += 1; | ||||
|       myself.updateValuesDisplay();       | ||||
|       myself.manageRencontre(coordTMR, cellDescr);       | ||||
|       myself.manageCaseHumide( cellDescr ); | ||||
| @@ -329,8 +347,7 @@ export class RdDTMRDialog extends Dialog { | ||||
|       this.displayPreviousRencontres();     | ||||
|     } ); | ||||
|  | ||||
|     await this.actor.santeIncDec("fatigue", 1); // 1 point defatigue | ||||
|     await this.actor.updatePointsDeReve(-1); // 1 point defatigue | ||||
|     await this.actor.updatePointsDeReve( (this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue | ||||
|     this.updateValuesDisplay(); | ||||
|     let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord); | ||||
|     this.manageRencontre( this.actor.data.data.reve.tmrpos.coord,cellDescr ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user