#52 Travaux en progres....
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
import { RdDCalendrierEditeur } from "./rdd-calendrier-editeur.js";
|
||||
import { RdDAstrologieEditeur } from "./rdd-astrologie-editeur.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
|
||||
@ -83,7 +85,18 @@ export class RdDCalendrier extends Application {
|
||||
getCurrentDayIndex( ) {
|
||||
return (this.calendrier.moisRdD * 28) + this.calendrier.jour;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getJoursSuivants( num) {
|
||||
let jours = [];
|
||||
let index = this.getCurrentDayIndex();
|
||||
for (let i=0; i<num; i++) {
|
||||
jours[i] = { label: this.getDateFromIndex(index), index: index };
|
||||
index += 1;
|
||||
}
|
||||
return jours;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
ajouterNombreAstral(index) {
|
||||
return {
|
||||
@ -98,9 +111,14 @@ export class RdDCalendrier extends Application {
|
||||
let index = this.getCurrentDayIndex();
|
||||
let astralData = this.listeNombreAstral.find( (nombreAstral, i) => nombreAstral.index == index );
|
||||
return astralData.nombreAstral || "N/A";
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getNombreAstral( index ) {
|
||||
let astralData = this.listeNombreAstral.find( (nombreAstral, i) => nombreAstral.index == index );
|
||||
return astralData.nombreAstral || "N/A";
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rebuildListeNombreAstral() {
|
||||
// Auto-create if needed
|
||||
@ -203,6 +221,43 @@ export class RdDCalendrier extends Application {
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getLectureAstrologieDifficulte( dateIndex ) {
|
||||
let indexNow = this.getCurrentDayIndex();
|
||||
let diffDay = dateIndex - indexNow;
|
||||
return - Math.floor(diffDay / 2);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async requestNombreAstral( request) {
|
||||
if ( game.user.isGM) { // Only GM
|
||||
console.log( request );
|
||||
let jourDiff = this.getLectureAstrologieDifficulte( request.date);
|
||||
let niveau = Number(request.astrologie.data.niveau) + Number(request.conditions) + Number(jourDiff);
|
||||
let rolled = await RdDResolutionTable.roll(request.carac_vue, niveau, undefined, false);
|
||||
|
||||
let nbAstral = this.getNombreAstral( request.date );
|
||||
let nbAstralFaux = nbAstral;
|
||||
request.isValid = true;
|
||||
if ( !rolled .isSuccess ) {
|
||||
request.isValid = false;
|
||||
while ( nbAstralFaux == nbAstral ) {
|
||||
nbAstralFaux = new Roll("1d12").roll().total;
|
||||
}
|
||||
nbAstral = nbAstralFaux;
|
||||
}
|
||||
request.nbAstral = nbAstral;
|
||||
if ( game.user.isGM) {
|
||||
RdDUtility.responseNombreAstral( request );
|
||||
} else {
|
||||
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||
msg: "msg_response_nombre_astral",
|
||||
data: request
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getAjustementAstrologique(heureNaissance)
|
||||
{
|
||||
|
Reference in New Issue
Block a user