forked from public/foundryvtt-reve-de-dragon
		
	Fix moral sur dissolution
This commit is contained in:
		| @@ -1535,6 +1535,7 @@ export class RdDActor extends Actor { | |||||||
|       } |       } | ||||||
|       await this.update({ 'data.compteurs': compteurs }); |       await this.update({ 'data.compteurs': compteurs }); | ||||||
|     } |     } | ||||||
|  |     return compteurs.moral.value; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -1625,7 +1626,7 @@ export class RdDActor extends Actor { | |||||||
|           content: "Décidément, vous avez l'alcool triste, vous perdez finalement un point de moral!", |           content: "Décidément, vous avez l'alcool triste, vous perdez finalement un point de moral!", | ||||||
|           whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name) |           whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name) | ||||||
|         }); |         }); | ||||||
|         this.moralIncDec(-1); |         await this.moralIncDec(-1); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -1789,9 +1790,11 @@ export class RdDActor extends Actor { | |||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _appliquerAppelMoral(rollData, display = true) { |   async _appliquerAppelMoral(rollData, display = true) { | ||||||
|     if (!this.isPersonnage()) return; |     if (!this.isPersonnage()) return; | ||||||
|     if (rollData.rolled.isEchec || (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score)) { |     if (!rollData.useMoral) return; | ||||||
|       this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */ |     if (rollData.rolled.isEchec || | ||||||
|       rollData.perteMoralEchec = true; |       (rollData.ajustements.diviseurSignificative && (rollData.rolled.roll * rollData.ajustements.diviseurSignificative > rollData.score))) { | ||||||
|  |       rollData.perteMoralEchec = rollData.moral<=-3? 'dissolution' : 'perte'; | ||||||
|  |       rollData.moral = await this.moralIncDec(-1); /* L'appel au moral a échoué. Le personnage perd un point de moral */ | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -125,7 +125,7 @@ export class RdDRoll extends Dialog { | |||||||
|     if (action.callbacks) |     if (action.callbacks) | ||||||
|       for (let callback of action.callbacks) { |       for (let callback of action.callbacks) { | ||||||
|         if (callback.condition == undefined || callback.condition(this.rollData)) { |         if (callback.condition == undefined || callback.condition(this.rollData)) { | ||||||
|           callback.action(this.rollData); |           await callback.action(this.rollData); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| {{#if use.appelAuMoral}} | {{#if useMoral}} | ||||||
| <span> | <span> | ||||||
|   Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} |   Vous avez fait appel {{#if (gt moral 0)}}au moral{{else}}à l'énergie du déspoir{{/if}} | ||||||
|   {{#if perteMoralEchec}}et échoué, votre moral baisse à {{moral}}. |   {{#if (eq perteMoralEchec 'dissolution')}}et échoué, cous marquez un point de dissolution!. | ||||||
|  |   {{else if (eq perteMoralEchec 'perte')}}et échoué, votre moral baisse à {{moral}}. | ||||||
|   {{else}}et réussi, votre moral reste de {{moral}}. |   {{else}}et réussi, votre moral reste de {{moral}}. | ||||||
|   {{/if}} |   {{/if}} | ||||||
| <span> | <span> | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} | {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} | ||||||
| <hr> | <hr> | ||||||
| <div> | <div> | ||||||
|   <span>{{#if rolled.ptTache}}{{rolled.ptTache}} points de tâche{{/if}}{{#if rolled.ptQualite}}{{#if rolled.ptTache}},{{/if}} ajustement Qualité {{numberFormat rolled.ptQualite decimals=0 sign=true}}{{/if}}</span> |   <span>{{#if rolled.ptTache}}{{rolled.ptTache}} points de tâche{{/if}}{{#if rolled.ptQualite}}{{#if rolled.ptTache}},{{/if}} Qualité ajustée de {{numberFormat rolled.ptQualite decimals=0 sign=true}}{{/if}}</span> | ||||||
| </div> | </div> | ||||||
| {{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}} | {{> "systems/foundryvtt-reve-de-dragon/templates/chat-info-appel-au-moral.html"}} | ||||||
| {{~#if show.explications}} | {{~#if show.explications}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user