forked from public/foundryvtt-reve-de-dragon
		
	Chiffre astral ajuste la chance
This commit is contained in:
		| @@ -204,10 +204,6 @@ export class RdDActorSheet extends ActorSheet { | |||||||
|     // Everything below here is only needed if the sheet is editable |     // Everything below here is only needed if the sheet is editable | ||||||
|     if (!this.options.editable) return; |     if (!this.options.editable) return; | ||||||
|  |  | ||||||
|     $(function () { |  | ||||||
|       $("#data.heure").val(this.actor.data.data.heure); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     // Update Inventory Item |     // Update Inventory Item | ||||||
|     html.find('.item-edit').click(ev => { |     html.find('.item-edit').click(ev => { | ||||||
|       const li = $(ev.currentTarget).parents(".item"); |       const li = $(ev.currentTarget).parents(".item"); | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ import { RdDRollTables } from "./rdd-rolltables.js"; | |||||||
| import { ChatUtility } from "./chat-utility.js"; | import { ChatUtility } from "./chat-utility.js"; | ||||||
| import { RdDItemSort } from "./item-sort.js"; | import { RdDItemSort } from "./item-sort.js"; | ||||||
| import { Grammar } from "./grammar.js"; | import { Grammar } from "./grammar.js"; | ||||||
|  | import { RdDCalendrier } from "./rdd-calendrier.js"; | ||||||
|  |  | ||||||
| export class RdDActor extends Actor { | export class RdDActor extends Actor { | ||||||
|  |  | ||||||
| @@ -1467,10 +1468,7 @@ export class RdDActor extends Actor { | |||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async rollAppelChance( ) |   async rollAppelChance( ) | ||||||
|   { |   { | ||||||
|     let rollData = {  |     let rollData = { selectedCarac: this.getCaracByName('chance-actuelle') }; | ||||||
|       selectedCarac: this.getCaracByName('chance-actuelle'), |  | ||||||
|       diffConditions: this.ajustementAstrologique() |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     const dialog = await RdDRoll.create(this, rollData, |     const dialog = await RdDRoll.create(this, rollData, | ||||||
|       { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'}, |       { html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html'}, | ||||||
| @@ -1508,8 +1506,8 @@ export class RdDActor extends Actor { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   ajustementAstrologique() { |   ajustementAstrologique() { | ||||||
|     //TODO: selon heure et heure de naissance... |     // selon l'heure de naissance... | ||||||
|     return 0; |     return game.system.rdd.calendrier.getAjustementAstrologique(this.data.data.heure); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   | |||||||
| @@ -85,7 +85,7 @@ export class RdDCalendrier extends Application { | |||||||
|   } |   } | ||||||
|      |      | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|    ajouterNombreAstral(index) { |   ajouterNombreAstral(index) { | ||||||
|     return { |     return { | ||||||
|       nombreAstral: new Roll("1d12").roll().total,  |       nombreAstral: new Roll("1d12").roll().total,  | ||||||
|       valeursFausses: [], |       valeursFausses: [], | ||||||
| @@ -100,7 +100,7 @@ export class RdDCalendrier extends Application { | |||||||
|       let index = this.getCurrentDayIndex(); |       let index = this.getCurrentDayIndex(); | ||||||
|       return this.listeNombreAstral[index].nombreAstral; |       return this.listeNombreAstral[index].nombreAstral; | ||||||
|     } |     } | ||||||
|     return '?'; |     return 0; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -203,6 +203,23 @@ export class RdDCalendrier extends Application { | |||||||
|     return data; |     return data; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   getAjustementAstrologique(heureNaissance) | ||||||
|  |   { | ||||||
|  |     let hn = heuresDef[heureNaissance].heure; | ||||||
|  |     let chiffreAstral = this.getCurrentNombreAstral(); | ||||||
|  |     let heureCourante = this.calendrier.heureRdD; | ||||||
|  |     let ecartChance = (hn + chiffreAstral - heureCourante)%12; | ||||||
|  |     console.log("ajustementAstrologique", heureNaissance, hn, chiffreAstral, heureCourante, ecartChance); | ||||||
|  |     switch (ecartChance) | ||||||
|  |     { | ||||||
|  |       case 0: return 4; | ||||||
|  |       case 4: case 8: return 2; | ||||||
|  |       case 6: return -4; | ||||||
|  |       case 3: case 9: return -2; | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   getData() { |   getData() { | ||||||
|     let data = super.getData(); |     let data = super.getData(); | ||||||
|   | |||||||
| @@ -40,7 +40,8 @@ export class RdDRoll extends Dialog { | |||||||
|         surencMalusApply: false, |         surencMalusApply: false, | ||||||
|         isNatation: rollData.competence ? rollData.competence.name.toLowerCase().includes("natation") : false, |         isNatation: rollData.competence ? rollData.competence.name.toLowerCase().includes("natation") : false, | ||||||
|         useEncForNatation: false, |         useEncForNatation: false, | ||||||
|         encValueForNatation: actor.encombrementTotal ? Math.floor(actor.encombrementTotal) : 0 |         encValueForNatation: actor.encombrementTotal ? Math.floor(actor.encombrementTotal) : 0, | ||||||
|  |         ajustementAstrologique: actor.ajustementAstrologique() | ||||||
|       }, |       }, | ||||||
|       { overwrite: false }); |       { overwrite: false }); | ||||||
|   } |   } | ||||||
| @@ -199,7 +200,7 @@ export class RdDRoll extends Dialog { | |||||||
|     let malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0; |     let malusEnc = (rollData.surencMalusApply) ? rollData.surencMalusValue : 0; | ||||||
|     let diffLibre = Misc.toInt(rollData.diffLibre); |     let diffLibre = Misc.toInt(rollData.diffLibre); | ||||||
|     let malusEncNatation = (rollData.useEncForNatation) ? -rollData.encValueForNatation : 0; |     let malusEncNatation = (rollData.useEncForNatation) ? -rollData.encValueForNatation : 0; | ||||||
|  |     let ajustementChance = rollData.selectedCarac.label.toLowerCase().includes('chance') ? rollData.ajustementAstrologique : 0; | ||||||
|     // Gestion malus armure |     // Gestion malus armure | ||||||
|     let malusArmureValue = 0; |     let malusArmureValue = 0; | ||||||
|     if (rollData.malusArmureValue != 0 && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) { |     if (rollData.malusArmureValue != 0 && (rollData.selectedCarac.label == "Agilité" || rollData.selectedCarac.label == "Dérobée")) { | ||||||
| @@ -209,6 +210,7 @@ export class RdDRoll extends Dialog { | |||||||
|       $("#addon-message").text(""); |       $("#addon-message").text(""); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     let diffCompetence = 0; |     let diffCompetence = 0; | ||||||
|     if (rollData.competence) { |     if (rollData.competence) { | ||||||
|       diffCompetence = Misc.toInt(rollData.competence.data.niveau); |       diffCompetence = Misc.toInt(rollData.competence.data.niveau); | ||||||
| @@ -218,7 +220,7 @@ export class RdDRoll extends Dialog { | |||||||
|       diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre); |       diffLibre = RdDItemSort.getDifficulte(rollData.selectedSort, diffLibre); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue; |     return etat + diffCompetence + diffLibre + diffConditions + malusEnc + malusEncNatation + malusArmureValue + ajustementChance; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user