diff --git a/module/actor.js b/module/actor.js
index 30dcded2..38c3b200 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -126,7 +126,9 @@ export class RdDActor extends Actor {
//rolled.isPart = true; // Pour tester le particulières
rollData.rolled = rolled; // garder le résultat
console.log("performRoll", rollData, rolled)
- this.currentRollData = rollData;
+ if ( !rollData.attackerRoll) // Store in the registry if not a defense roll
+ game.system.rdd.rollDataHandler[this.data._id] = rollData;
+
if (rolled.isPart && rollData.arme && !rollData.attackerRoll) { // Réussite particulière avec attaque -> choix !
let message = "Réussite particulière en attaque";
message = message + "
Attaquer en Force";
@@ -230,6 +232,9 @@ export class RdDActor extends Actor {
}
ChatMessage.create(chatOptions);
+ if ( !rollData.attackerRoll) // Store it again the registry if not a defense roll
+ game.system.rdd.rollDataHandler[this.data._id] = rollData;
+
// This an attack, generate the defense message
if (defenseMsg) {
defenseMsg.rollData = duplicate(rollData);
@@ -238,6 +243,9 @@ export class RdDActor extends Actor {
msg: "msg_defense",
data: defenseMsg
});
+ if ( game.user.isGM ) { // Always push the message to the MJ
+ ChatMessage.create(defenseMsg);
+ }
} else {
defenseMsg.whisper = [game.user];
ChatMessage.create(defenseMsg);
diff --git a/module/rdd-utility.js b/module/rdd-utility.js
index 308c03c2..d672e908 100644
--- a/module/rdd-utility.js
+++ b/module/rdd-utility.js
@@ -511,7 +511,7 @@ export class RdDUtility {
if ( defenderActor ) {
if ( (game.user.isGM && !defenderActor.hasPlayerOwner) || (defenderActor.hasPlayerOwner && (game.user.character.id == defenderActor.id) ) ) {
console.log("User is pushing message...", game.user.name);
- defenderActor.currentRollData = duplicate(sockmsg.data.rollData);
+ game.system.rdd.rollDataHandler[sockmsg.data.attackerid] = duplicate(sockmsg.data.rollData);
sockmsg.data.whisper = [ game.user ];
sockmsg.data.blind = true;
sockmsg.data.rollMode = "blindroll";
@@ -544,24 +544,27 @@ export class RdDUtility {
html.on("click", '#parer-button', event => {
event.preventDefault();
+ let attackerid = event.currentTarget.attributes['data-attackerid'].value;
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
let armeId = event.currentTarget.attributes['data-armeid'].value;
- let rollData = defenderActor.currentRollData;
+ let rollData = game.system.rdd.rollDataHandler[attackerid];
defenderActor.parerAttaque( rollData, armeId );
});
html.on("click", '#esquiver-button', event => {
event.preventDefault();
+ let attackerid = event.currentTarget.attributes['data-attackerid'].value;
let defenderActor = game.actors.get(event.currentTarget.attributes['data-defenderid'].value );
- let rollData = defenderActor.currentRollData;
+ let rollData = game.system.rdd.rollDataHandler[attackerid];
//console.log("Esquive !", rollData, defenderActor);
defenderActor.esquiverAttaque( rollData );
});
html.on("click", '#particuliere-attaque', event => {
event.preventDefault();
+ let attackerid = event.currentTarget.attributes['data-attackerid'].value;
let attackerActor = game.actors.get(event.currentTarget.attributes['data-attackerid'].value );
- let rollData = attackerActor.currentRollData;
+ let rollData = game.system.rdd.rollDataHandler[attackerid];
rollData.particuliereAttaque = game.actors.get(event.currentTarget.attributes['data-mode'].value );
//console.log("Particulère !", rollData);
attackerActor.continueRoll( rollData );
diff --git a/system.json b/system.json
index 4df1afbc..db7f2a8c 100644
--- a/system.json
+++ b/system.json
@@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
- "version": "0.9.51",
+ "version": "0.9.52",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.6",
"templateVersion": 46,