Sonné est un StatusEffect

This commit is contained in:
Vincent Vandemeulebrouck
2021-06-30 01:01:24 +02:00
parent e74f6b14d3
commit c857def360
9 changed files with 49 additions and 59 deletions

View File

@ -38,6 +38,9 @@ export class RdDCombatManager extends Combat {
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
RdDCombatManager.pushInitiativeOptions(html, options);
});
Hooks.on("preDeleteCombat", (combat, html, id) => {
combat.onPreDeleteCombat()
});
}
/* -------------------------------------------- */
@ -48,10 +51,22 @@ export class RdDCombatManager extends Combat {
}
/* -------------------------------------------- */
cleanSonne() {
async nextRound() {
this.cleanItemUse();
await this.finDeRound();
return await super.nextRound();
}
/* -------------------------------------------- */
async onPreDeleteCombat() {
await this.finDeRound({ terminer: true });
}
/* -------------------------------------------- */
async finDeRound(options = { terminer: false }) {
for (let combatant of this.data.combatants) {
if (combatant.actor) {
combatant.actor.verifierSonneRound(this.current.round);
await combatant.actor.finDeRound(options);
}
else {
ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur!`)
@ -59,14 +74,6 @@ export class RdDCombatManager extends Combat {
}
}
/* -------------------------------------------- */
async nextRound() {
//console.log('New round !');s
this.cleanItemUse();
this.cleanSonne();
return super.nextRound();
}
/************************************************************************************/
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
console.log(`${game.data.system.data.title} | Combat.rollInitiative()`, ids, formula, messageOptions);