Meilleure gestion blessures graves vs endurance

This commit is contained in:
2021-10-29 20:58:57 +02:00
parent 909dd12cec
commit 21ad671ac7
8 changed files with 78 additions and 16 deletions

View File

@ -221,16 +221,33 @@ export class RdDCalendrier extends Application {
this.updateDisplay();
}
/* -------------------------------------------- */
checkMaladie( periode) {
for (let actor of game.actors) {
if (actor.type == 'personnage') {
let maladies = actor.filterItems( item => (item.type == 'maladie' || item.type == 'poison') && item.data.periodicite.toLowerCase().includes(periode) );
for (let maladie of maladies) {
ChatMessage.create({ content: `${actor.name} souffre de ${maladie.name} (${maladie.type}): vérifiez que les effets ne se sont pas aggravés !` });
}
}
}
}
/* -------------------------------------------- */
async incrementTime(minutes = 0) {
this.calendrier.minutesRelative += minutes;
this.checkMaladie("round");
this.checkMaladie("minute");
if (this.calendrier.minutesRelative >= RDD_MINUTES_PAR_HEURES) {
this.calendrier.minutesRelative -= RDD_MINUTES_PAR_HEURES;
this.calendrier.heureRdD += 1;
}
this.checkMaladie("heure");
}
if (this.calendrier.heureRdD >= RDD_HEURES_PAR_JOUR) {
this.calendrier.heureRdD -= RDD_HEURES_PAR_JOUR;
await this.incrementerJour();
this.checkMaladie("heure");
this.checkMaladie("jour");
}
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
// Notification aux joueurs