Appel à la chance sur les défenses

Suppressions de ChatMessage selon contenu

En ayant un <div id=""> avec id unique, on peut retrouver et supprimer
les messages obsoletes (par exemple, les choix dans les combats).
This commit is contained in:
Vincent Vandemeulebrouck
2021-01-07 00:32:22 +01:00
parent 212a94afee
commit 47fb2d511e
6 changed files with 212 additions and 67 deletions

View File

@ -206,6 +206,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/hud-actor-attaque.html',
// messages tchat
'systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html',
'systems/foundryvtt-reve-de-dragon/templates/chat-demande-defense.html',
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-appelchance.html',
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-attaque.html',
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-parade.html',
@ -784,7 +785,7 @@ export class RdDUtility {
}
if ((game.user.isGM && !defenderToken.actor.hasPlayerOwner) || (defenderToken.actor.hasPlayerOwner && (game.user.character.id == defenderToken.actor.data._id))) {
//console.log("User is pushing message...", game.user.name);
game.system.rdd.rollDataHandler[data.attackerId] = duplicate(data.rollData);
game.system.rdd.rollDataHandler.attaques[data.attackerId] = duplicate(data.rollData);
data.whisper = [game.user];
data.blind = true;
data.rollMode = "blindroll";
@ -886,9 +887,12 @@ export class RdDUtility {
/* -------------------------------------------- */
static _handleMsgEncaisser(data) {
if (game.user.isGM) { // Seul le GM effectue l'encaissement sur la fiche
let attackerRoll = game.system.rdd.rollDataHandler[data.attackerId]; // Retrieve the rolldata from the store
let defenderToken = canvas.tokens.get(data.defenderTokenId);
defenderToken.actor.encaisserDommages(attackerRoll);
let attackerRoll = game.system.rdd.rollDataHandler.attaques[data.attackerId]; // Retrieve the rolldata from the store
game.system.rdd.rollDataHandler.attaques[data.attackerId] = undefined;
game.system.rdd.rollDataHandler.defenses[attackerRoll.passeArme] = undefined;
let defender = canvas.tokens.get(data.defenderTokenId).actor;
defender.encaisserDommages(attackerRoll);
}
}