This commit is contained in:
sladecraven 2020-11-17 09:58:46 +01:00
parent 87b594953b
commit 2bff1b16be
3 changed files with 17 additions and 6 deletions

View File

@ -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 = "<strong>Réussite particulière en attaque</strong>";
message = message + "<br><a class='chat-card-button' id='particuliere-attaque' data-mode='force' data-attackerid='" + this.data._id + "'>Attaquer en Force</a>";
@ -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);

View File

@ -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 );

View File

@ -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,