Fix astrologie joueur

This commit is contained in:
Vincent Vandemeulebrouck
2022-12-29 02:31:29 +01:00
parent c79298b60a
commit 454193490d
5 changed files with 66 additions and 52 deletions

View File

@ -3073,32 +3073,30 @@ export class RdDActor extends RdDBaseActor {
/* -------------------------------------------- */
async ajouteNombreAstral(callData) {
// Gestion expérience (si existante)
callData.competence = this.getCompetence("astrologie")
callData.selectedCarac = this.system.carac["vue"];
this.appliquerAjoutExperience(callData, 'hide');
// Ajout du nombre astral
const item = {
name: "Nombre Astral", type: "nombreastral", system:
{ value: callData.nbAstral, istrue: callData.isvalid, jourindex: Number(callData.date), jourlabel: game.system.rdd.calendrier.getDateFromIndex(Number(callData.date)) }
};
await this.createEmbeddedDocuments("Item", [item]);
// Suppression des anciens nombres astraux
let toDelete = this.listItems('nombreastral').filter(it => it.system.jourindex < game.system.rdd.calendrier.getCurrentDayIndex());
const deletions = toDelete.map(it => it._id);
await this.deleteEmbeddedDocuments("Item", deletions);
// Affichage Dialog
this.astrologieNombresAstraux();
}
async supprimerAnciensNombresAstraux() {
const toDelete = this.listItems('nombreastral')
.filter(it => it.system.jourindex < game.system.rdd.calendrier.getCurrentDayIndex())
.map(it => it._id);
await this.deleteEmbeddedDocuments("Item", toDelete);
}
/* -------------------------------------------- */
async astrologieNombresAstraux() {
// Suppression des anciens nombres astraux
await this.supprimerAnciensNombresAstraux();
// Afficher l'interface spéciale
const astrologieDialog = await RdDAstrologieJoueur.create(this, {});
astrologieDialog.render(true);
await RdDAstrologieJoueur.create(this);
}
/* -------------------------------------------- */