Sync combat
This commit is contained in:
parent
0efaac8d68
commit
d215629c9b
@ -215,7 +215,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
let reveValue = event.currentTarget.value;
|
let reveValue = event.currentTarget.value;
|
||||||
let reve = duplicate( this.actor.data.data.reve.reve );
|
let reve = duplicate( this.actor.data.data.reve.reve );
|
||||||
reve.value = reveValue;
|
reve.value = reveValue;
|
||||||
this.actor.update("data.reve.reve", reve );
|
this.actor.update( { "data.reve.reve": reve } );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// On competence change
|
// On competence change
|
||||||
|
@ -265,9 +265,17 @@ export class RdDActor extends Actor {
|
|||||||
ChatMessage.create( chatOptions );
|
ChatMessage.create( chatOptions );
|
||||||
|
|
||||||
// This an attack, generate the defense message
|
// This an attack, generate the defense message
|
||||||
if ( defenseMsg ) { // target hit !
|
if ( defenseMsg ) {
|
||||||
ChatMessage.create( defenseMsg );
|
if ( defenseMsg.toSocket) {
|
||||||
|
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||||
|
msg: "msg_defense",
|
||||||
|
data: defenseMsg
|
||||||
|
} );
|
||||||
|
} else {
|
||||||
|
ChatMessage.create( defenseMsg );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get damages!
|
// Get damages!
|
||||||
if ( encaisser ) {
|
if ( encaisser ) {
|
||||||
this.encaisserDommages( rollData.attackerRoll );
|
this.encaisserDommages( rollData.attackerRoll );
|
||||||
|
@ -430,7 +430,10 @@ export class RdDUtility {
|
|||||||
let defenseMsg = { title: "Défense en combat",
|
let defenseMsg = { title: "Défense en combat",
|
||||||
content: "<strong>"+myTarget.name+"</strong> doit se défendre : <br><span class='chat-card-button-area'>" +
|
content: "<strong>"+myTarget.name+"</strong> doit se défendre : <br><span class='chat-card-button-area'>" +
|
||||||
"<a class='chat-card-button' id='encaisser-button' data-attackerid='"+attacker.data._id + "' data-defenderid='" + myTarget.data._id + "'>Encaisser !</a></span>",
|
"<a class='chat-card-button' id='encaisser-button' data-attackerid='"+attacker.data._id + "' data-defenderid='" + myTarget.data._id + "'>Encaisser !</a></span>",
|
||||||
whisper: ChatMessage.getWhisperRecipients( myTarget.name ) };
|
whisper: ChatMessage.getWhisperRecipients( myTarget.name ),
|
||||||
|
defenderid: myTarget.data._id,
|
||||||
|
rollMode: true
|
||||||
|
};
|
||||||
|
|
||||||
if ( rollData.competence.data.categorie == "melee" ) { // Melee attack
|
if ( rollData.competence.data.categorie == "melee" ) { // Melee attack
|
||||||
let defenderArmes = [];
|
let defenderArmes = [];
|
||||||
@ -460,6 +463,8 @@ export class RdDUtility {
|
|||||||
defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerid='"+attacker.data._id + "' data-defenderid='" + myTarget.data._id + "'>Esquiver</a></span>";
|
defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerid='"+attacker.data._id + "' data-defenderid='" + myTarget.data._id + "'>Esquiver</a></span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defenseMsg.toSocket = (!game.user.isGM) ? true : false;
|
||||||
|
|
||||||
return defenseMsg;
|
return defenseMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,9 +475,17 @@ export class RdDUtility {
|
|||||||
if ( sockmsg.msg == "msg_encaisser" ) {
|
if ( sockmsg.msg == "msg_encaisser" ) {
|
||||||
if ( game.user.isGM ) {
|
if ( game.user.isGM ) {
|
||||||
console.log("Encaisser ici !!!");
|
console.log("Encaisser ici !!!");
|
||||||
defenderActor = game.actors.get( sockmsg.data.defenderid );
|
let defenderActor = game.actors.get( sockmsg.data.defenderid );
|
||||||
defenderActor.encaisserDommages( sockmsg.data );
|
defenderActor.encaisserDommages( sockmsg.data );
|
||||||
}
|
}
|
||||||
|
} else if (sockmsg.msg == "msg_defense" ) {
|
||||||
|
let defenderActor = game.actors.get( sockmsg.data.defenderid );
|
||||||
|
if ( (game.user.isGM && !defenderActor.isPC) || (defenderActor.isPC && game.user.character.id == defenderActor.id ) ) {
|
||||||
|
sockmsg.data.whisper = [ game.user ];
|
||||||
|
sockmsg.data.blind = true;
|
||||||
|
sockmsg.data.rollMode = "blindroll";
|
||||||
|
ChatMessage.create( sockmsg.data );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user