Ajout de commentaire et suppression des logs
This commit is contained in:
		| @@ -1595,7 +1595,7 @@ export class RdDActor extends Actor { | ||||
|   } | ||||
|   | ||||
|   /* -------------------------------------------- */ | ||||
|   createCallbackAppelAuMoral() { | ||||
|   createCallbackAppelAuMoral() { /* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */ | ||||
|     return { | ||||
|       condition: r => r.use.appelAuMoral && game.settings.get("core", "rollMode") != 'selfroll', | ||||
|       action: r => { console.log("createCallbackAppelAuMoral"); this.displayAppelAuMoral ; console.log(r.rolled.isEchec); this._appliquerAppelMoral(r, game.settings.get("core", "rollMode") != 'blindroll') } | ||||
| @@ -1675,23 +1675,10 @@ export class RdDActor extends Actor { | ||||
|    | ||||
|   /* -------------------------------------------- */ | ||||
|   async _appliquerAppelMoral(rollData, display = true) { | ||||
| 	  console.log("_appliquerAppelMoral"); | ||||
| 	  console.log("_appliquerAppelMoral"); | ||||
| 	  console.log("_appliquerAppelMoral"); | ||||
| 	  console.log("_appliquerAppelMoral"); | ||||
| 	  console.log(rollData); | ||||
| 	  console.log(this.name); | ||||
| 	  console.log(this); | ||||
|     if (!this.isPersonnage()) return; | ||||
|     if (!rollData.rolled.isEchec) return; | ||||
|     const waitUpdate = this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */ | ||||
| 	console.log("_appliquerAppelMoral : moral diminuer"); | ||||
| 	rollData.moralDiminuer = true; | ||||
| 	rollData.moralActualiser = 7; | ||||
| 	await waitUpdate; | ||||
| 	rollData.moralActualiser = this.getMoralTotal(); | ||||
| 	console.log("rollData.moralDiminuer: "+rollData.moralDiminuer); | ||||
| 	console.log("rollData.moralActualiser: "+rollData.moralActualiser); | ||||
| 	rollData.jetEchouerMoralDiminuer = true; | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   | ||||
| @@ -46,17 +46,17 @@ export class RdDRoll extends Dialog { | ||||
|       surencMalusFlag: actor.isPersonnage() ? (actor.data.data.compteurs.surenc.value < 0) : false,  | ||||
|       surencMalusValue: actor.getSurenc(), | ||||
|       useMalusSurenc: false, | ||||
|       appelAuMoralDemander :false, | ||||
|       use: { libre:true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false }, | ||||
|       appelAuMoralPossible : false,    /* Est-ce que l'appel au moral est possible ? Variable utisé pour l'affichage ou non de la ligne concernant le moral */ | ||||
|       appelAuMoralDemander :false,     /* Est-ce que le joueur demande d'utiliser le moral ? Utile si le joueur change plusieurs fois de carac associée. */ | ||||
|       jetEchouerMoralDiminuer : false, /* Pour l'affichage dans le chat */ | ||||
|       use: { libre:true, conditions: true, surenc: false, encTotal: false, appelAuMoral : false  /* Le jet se fait ou non en utilisant l'appel au moral */}, | ||||
|       isMalusEncombrementTotal: RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), | ||||
|       useMalusEncTotal: false, | ||||
|       encTotal: actor.getEncTotal(), | ||||
|       ajustementAstrologique: actor.ajustementAstrologique(), | ||||
|       surprise: actor.getSurprise(false), | ||||
|     } | ||||
|     console.log("defaultRollData.appelAuMoralFlag : "+defaultRollData.appelAuMoralFlag); | ||||
|     mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false }); | ||||
|     console.log("rollData.appelAuMoralFlag : "+rollData.appelAuMoralFlag); | ||||
|     if ( rollData.forceCarac) { | ||||
|       rollData.carac = rollData.forceCarac; | ||||
|     } | ||||
| @@ -190,21 +190,25 @@ export class RdDRoll extends Dialog { | ||||
|       this.rollData.useMalusEncTotal = event.currentTarget.checked; | ||||
|       this.updateRollResult(); | ||||
|     }); | ||||
|     html.find('#iconeSmile').change((event) => { | ||||
| 	  console.log("iconeSmile"); | ||||
|       console.log(html.find('.iconeSmile')); | ||||
|       this.updateRollResult(); | ||||
|     });      | ||||
|     html.find('#useAppelAuMoralCheckbox').change((event) => { /* l'appel au moral, qui donne un bonus de +1 */ | ||||
| 		 | ||||
| 	  console.log("#useAppelAuMoralCheckbox"); | ||||
|       //console.log("surencMalusFlag : "+surencMalusFlag); | ||||
|       console.log("this.appelAuMoralFlag : "+this.appelAuMoralFlag); | ||||
|       console.log("this.rollData.moral : "+this.rollData.moral); | ||||
|       console.log("this.rollData.ajustements : "+this.rollData.ajustements); | ||||
|       console.log("this.rollData.ajustements.moral : "+this.rollData.ajustements.moral); | ||||
|       console.log("this.rollData.ajustements.moral.isVisible : "+this.rollData.ajustements.moral.isVisible); | ||||
| 	  console.log("event.currentTarget.checked : "+event.currentTarget.checked); | ||||
|       console.log("this.rollData.use.appelAuMoral : "+this.rollData.use.appelAuMoral); | ||||
| 	  this.rollData.appelAuMoralDemander = event.currentTarget.checked | ||||
| 	  // this.rollData.use.appelAuMoral = event.currentTarget.checked | ||||
|       console.log("this.rollData.moral : "+this.rollData.moral); | ||||
|       console.log("this.rollData.use.appelAuMoral : "+this.rollData.use.appelAuMoral); | ||||
|       if ( this.rollData.appelAuMoralDemander ) { | ||||
| 		if ( this.rollData.moral > 0 ) { | ||||
|           html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-heureux.svg"; | ||||
| 		  html.find('#textSmile')[0].innerHTML = "Appel au moral"; | ||||
| 	    } else { | ||||
|           html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-malheureux.svg"; | ||||
| 		  html.find('#textSmile')[0].innerHTML = "Appel à l'énergie du désespoir"; | ||||
| 	    } | ||||
| 	  } else { | ||||
| 		html.find('#iconeSmile')[0].src = "/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg"; | ||||
| 		html.find('#textSmile')[0].innerHTML = "Sans appel au moral"; | ||||
| 	  }  | ||||
|       this.updateRollResult(); | ||||
|     }); | ||||
|     // Section Méditation | ||||
| @@ -231,28 +235,21 @@ export class RdDRoll extends Dialog { | ||||
|       rollData.bonus = RdDItemSort.getCaseBonus(rollData.selectedSort, rollData.coord); | ||||
|     } | ||||
|      | ||||
|     /* ! actor.isPersonnage() || */  | ||||
|     if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac) ) { | ||||
|     if ( ! RdDCarac.isActionPhysique(rollData.selectedCarac || ! actor.isPersonnage() ) ) { | ||||
| 	  rollData.appelAuMoralPossible = false; | ||||
| 	  rollData.use.appelAuMoral = false; | ||||
| 	} else { | ||||
| 	  rollData.appelAuMoralPossible = true; | ||||
| 	  rollData.use.appelAuMoral = rollData.appelAuMoralDemander; | ||||
| 	   | ||||
| 	} | ||||
|  | ||||
|  | ||||
|     RollDataAjustements.calcul(rollData, this.actor); | ||||
|     rollData.finalLevel = this._computeFinalLevel(rollData); | ||||
|      | ||||
|     console.log("updateRollResult"); | ||||
|     console.log("rollData.ajustements.moralTotal.used: "+rollData.ajustements.moralTotal.used); | ||||
|     console.log("rollData.ajustements.moral.used: "+rollData.ajustements.moral.used); | ||||
|     console.log("rollData.use.appelAuMoral: "+rollData.use.appelAuMoral); | ||||
|     console.log("rollData.selectedCarac: ");  | ||||
|     console.log(rollData.selectedCarac);  | ||||
|     console.log("RdDCarac.isActionPhysique(rollData.selectedCarac): "+RdDCarac.isActionPhysique(rollData.selectedCarac));  | ||||
|      | ||||
|     HtmlUtility._showControlWhen($(".diffMoral"), rollData.ajustements.moralTotal.used); | ||||
|     HtmlUtility._showControlWhen($(".diffAppelAuMoral"),  RdDCarac.isActionPhysique(rollData.selectedCarac) ); | ||||
|     HtmlUtility._showControlWhen($(".diffAppelAuMoral-checker"),  RdDCarac.isActionPhysique(rollData.selectedCarac) ); | ||||
|     HtmlUtility._showControlWhen($("#divAppelAuMoral"),  rollData.appelAuMoralPossible ); | ||||
|     HtmlUtility._showControlWhen($("#etat-general"), !RdDCarac.isIgnoreEtatGeneral(rollData.selectedCarac, rollData.competence)); | ||||
|     HtmlUtility._showControlWhen($("#ajust-astrologique"), RdDResolutionTable.isAjustementAstrologique(rollData)); | ||||
|  | ||||
|   | ||||
| @@ -811,22 +811,26 @@ ul, li { | ||||
|   left: 0px; | ||||
|   text-align: center; | ||||
| } | ||||
|  | ||||
| 	 | ||||
| .diffAppelAuMoral { | ||||
|   display: none !important; | ||||
| } | ||||
| .diffAppelAuMoral-checker { | ||||
|   display: inline-block; | ||||
|   background-image: url('../icons/moral-neutre.svg'); | ||||
|   width: 20px; | ||||
|   height: 20px; | ||||
|   background-image: url('../icons/moral-neutre.svg'); | ||||
|   background-size: cover; | ||||
| } | ||||
| .diffAppelAuMoral:checked + .diffAppelAuMoral-checker { | ||||
|   background-image: url('../icons/moral-heureux.svg'); | ||||
| } | ||||
|  | ||||
| .iconeSmile	 { | ||||
|   height: 20px; | ||||
|   width: 20px; | ||||
|   border:none; | ||||
|   outline: none; | ||||
|   background-size: cover; | ||||
| } | ||||
| .textSmile { | ||||
| } | ||||
|  | ||||
| /* ======================================== */ | ||||
| /* Fatigue CSS */ | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| {{#if use.appelAuMoral}}<div> | ||||
|   {{alias}} fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} {{#if moralDiminuer}}et échoue, diminuant son moral.{{else}} et réussit.{{/if}} | ||||
|   {{^moralDiminuer}} Son moral reste inchangé à {{moral}}.{{/moralDiminuer}} | ||||
|   {{^jetEchouerMoralDiminuer}} Son moral reste inchangé à {{moral}}.{{/jetEchouerMoralDiminuer}} | ||||
| <div>{{/if}} | ||||
|   | ||||
| @@ -11,8 +11,6 @@ | ||||
|   </select> | ||||
|   <label></label> | ||||
| </div> | ||||
| <input class="diffAppelAuMoral"  id="useAppelAuMoralCheckbox" type="checkbox" name="appelAuMoralDemander" /> | ||||
| <label for="useAppelAuMoralCheckbox" class="diffAppelAuMoral-checker" id="diffAppelAuMoral-checker"></label> | ||||
| <div class="form-group"> | ||||
|   {{#if attackerRoll}} | ||||
|   <label for="categorie">Difficulté</label> | ||||
| @@ -61,6 +59,12 @@ | ||||
|     {{/if}} | ||||
|   </div> | ||||
| {{/if}} | ||||
| <div class="form-group" id="divAppelAuMoral" > | ||||
|   <input class="diffAppelAuMoral"  id="useAppelAuMoralCheckbox" type="checkbox" name="appelAuMoralDemander" /> | ||||
|   <label for="useAppelAuMoralCheckbox" class="diffAppelAuMoral-checker" id="diffAppelAuMoral-checker"></label> | ||||
|   <label for="useAppelAuMoralCheckbox" class="textSmile" id="textSmile" >Sans appel au moral</label> | ||||
|   <img for="useAppelAuMoralCheckbox" class="iconeSmile"  id="iconeSmile" src="/systems/foundryvtt-reve-de-dragon/icons/moral-neutre.svg"> | ||||
| </div> | ||||
|  | ||||
| {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-surenc.html"}} | ||||
| {{>"systems/foundryvtt-reve-de-dragon/templates/dialog-roll-enctotal.html"}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user