Gestion des signes draconiques #455
@@ -1435,22 +1435,21 @@ export class RdDActor extends Actor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
  async moralIncDec(ajustementMoral) {
 | 
					  async moralIncDec(ajustementMoral) {
 | 
				
			||||||
    let actorData
 | 
					    let tplData = Misc.templateData(this);
 | 
				
			||||||
    if (ajustementMoral != 0) {
 | 
					    if (ajustementMoral != 0) {
 | 
				
			||||||
      actorData = Misc.data(this);
 | 
					      let moral = Misc.toInt(tplData.compteurs.moral.value) + ajustementMoral
 | 
				
			||||||
      let moral = Misc.toInt(actorData.data.compteurs.moral.value) + ajustementMoral
 | 
					 | 
				
			||||||
      if (moral > 3) { // exaltation
 | 
					      if (moral > 3) { // exaltation
 | 
				
			||||||
        const exaltation = Misc.toInt(actorData.data.compteurs.exaltation.value) + moral - 3;
 | 
					        const exaltation = Misc.toInt(tplData.compteurs.exaltation.value) + moral - 3;
 | 
				
			||||||
        await this.updateCompteurValue('exaltation', exaltation);
 | 
					        await this.updateCompteurValue('exaltation', exaltation);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (moral < -3) { // dissolution
 | 
					      if (moral < -3) { // dissolution
 | 
				
			||||||
        const dissolution = Misc.toInt(actorData.data.compteurs.dissolution.value) + 3 - moral;
 | 
					        const dissolution = Misc.toInt(tplData.compteurs.dissolution.value) + 3 - moral;
 | 
				
			||||||
        await this.updateCompteurValue('dissolution', dissolution);
 | 
					        await this.updateCompteurValue('dissolution', dissolution);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      moral = Math.max(-3, Math.min(moral, 3));
 | 
					      moral = Math.max(-3, Math.min(moral, 3));
 | 
				
			||||||
      await this.updateCompteurValue('moral', moral);
 | 
					      await this.updateCompteurValue('moral', moral);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return actorData.data.compteurs.moral.value;
 | 
					    return tplData.compteurs.moral.value;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* -------------------------------------------- */
 | 
					  /* -------------------------------------------- */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user