Améliorations du combat
- nettoyage des infos et messages de combat améliorés - message de status envoyé uniquement par le GM (pour éviter les doublons) - stockage des infos de passes d'armes géré par RdDCombat Déplacement des Hooks/notifications de messages socket: - liés au combat dans la méthode RdDCombat.init Convention de nommage: les méthodes de gestion de notification par hook/socket sont préfixées 'on' ex: onSocketMessage, onUpdateCombat, onPreDeleteCombat
This commit is contained in:
parent
ad00a3f700
commit
3f62582af5
@ -25,7 +25,9 @@ import { RdDAlchimie } from "./rdd-alchimie.js";
|
|||||||
* @extends {Actor}
|
* @extends {Actor}
|
||||||
*/
|
*/
|
||||||
export class RdDActor extends Actor {
|
export class RdDActor extends Actor {
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static init() {
|
||||||
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/**
|
/**
|
||||||
* Override the create() function to provide additional RdD functionality.
|
* Override the create() function to provide additional RdD functionality.
|
||||||
@ -2196,15 +2198,15 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async encaisserDommages(attackerRoll, attacker = undefined) {
|
async encaisserDommages(rollData, attacker = undefined) {
|
||||||
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("encaisserDommages", attackerRoll)
|
console.log("encaisserDommages", rollData)
|
||||||
|
|
||||||
let santeOrig = duplicate(this.data.data.sante);
|
let santeOrig = duplicate(this.data.data.sante);
|
||||||
let encaissement = this.jetEncaissement(attackerRoll);
|
let encaissement = this.jetEncaissement(rollData);
|
||||||
|
|
||||||
this.ajouterBlessure(encaissement); // Will upate the result table
|
this.ajouterBlessure(encaissement); // Will upate the result table
|
||||||
const perteVie = await this.santeIncDec("vie", - encaissement.vie);
|
const perteVie = await this.santeIncDec("vie", - encaissement.vie);
|
||||||
@ -2513,7 +2515,6 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_alchimieResult(rollData) {
|
_alchimieResult(rollData) {
|
||||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-alchimie.html');
|
||||||
|
@ -9,6 +9,67 @@ import { RdDRollTables } from "./rdd-rolltables.js";
|
|||||||
|
|
||||||
export class RdDCombat {
|
export class RdDCombat {
|
||||||
|
|
||||||
|
static init() {
|
||||||
|
this.initStorePasseArmes();
|
||||||
|
Hooks.on("updateCombat", (combat, data) => { RdDCombat.onUpdateCombat(combat, data) });
|
||||||
|
Hooks.on("preDeleteCombat", (combat, options) => { RdDCombat.onPreDeleteCombat(combat, options); });
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static initStorePasseArmes() {
|
||||||
|
game.system.rdd.combatStore = {
|
||||||
|
attaques: {},
|
||||||
|
defenses: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static onSocketMessage(sockmsg) {
|
||||||
|
switch (sockmsg.msg) {
|
||||||
|
case "msg_encaisser":
|
||||||
|
return RdDCombat.terminerPasseArmes(data);
|
||||||
|
case "msg_defense":
|
||||||
|
return RdDCombat.handleMsgDefense(sockmsg.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static onUpdateCombat(combat, data) {
|
||||||
|
if (combat.data.round != 0 && combat.turns && combat.data.active) {
|
||||||
|
RdDCombat.combatNouveauRound(combat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static onPreDeleteCombat(combat, options) {
|
||||||
|
if (game.user.isGM) {
|
||||||
|
ChatUtility.removeMyChatMessageContaining(`<div data-combatid="${combat.id}" data-combatmessage="actor-turn-summary">`)
|
||||||
|
/*
|
||||||
|
* TODO: support de plusieurs combats parallèles
|
||||||
|
* il faudrait avoir un id de combat en plus de celui de passe d'armes
|
||||||
|
*/
|
||||||
|
for (const key in game.system.rdd.combatStore.attaques) {
|
||||||
|
const attackerRoll = game.system.rdd.combatStore.attaques[key];
|
||||||
|
ChatUtility.removeChatMessageActionsPasseArme(`<div data-passearme="${attackerRoll.passeArme}">`);
|
||||||
|
}
|
||||||
|
for (const key in game.system.rdd.combatStore.defenses) {
|
||||||
|
const defenderRoll = game.system.rdd.combatStore.defenses[key];
|
||||||
|
ChatUtility.removeMyChatMessageContaining(`<div data-passearme="${defenderRoll.passeArme}">`);
|
||||||
|
}
|
||||||
|
RdDCombat.initStorePasseArmes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static combatNouveauRound(combat) {
|
||||||
|
let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId);
|
||||||
|
if (game.user.isGM) {
|
||||||
|
// seul le GM notifie le status
|
||||||
|
this.displayActorCombatStatus(combat, turn.actor);
|
||||||
|
// TODO Playaudio for player??
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static isActive() {
|
static isActive() {
|
||||||
return true;
|
return true;
|
||||||
@ -58,6 +119,33 @@ export class RdDCombat {
|
|||||||
return RdDCombat.createUsingTarget(attacker)
|
return RdDCombat.createUsingTarget(attacker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static handleMsgDefense(data) {
|
||||||
|
let defenderToken = canvas.tokens.get(data.defenderTokenId);
|
||||||
|
if (defenderToken) {
|
||||||
|
if (!game.user.isGM && game.user.character == undefined) { // vérification / sanity check
|
||||||
|
ui.notifications.error("Le joueur " + game.user.name + " n'est connecté à aucun personnage. Impossible de continuer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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.combatStore.attaques[data.attackerId] = duplicate(data.rollData);
|
||||||
|
data.whisper = [game.user];
|
||||||
|
data.blind = true;
|
||||||
|
data.rollMode = "blindroll";
|
||||||
|
ChatMessage.create(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static terminerPasseArmes(data) {
|
||||||
|
if (game.user.isGM) { // Seul le GM nettoie le stockage des données de combat
|
||||||
|
let attackerRoll = game.system.rdd.combatStore.attaques[data.attackerId]; // Retrieve the rolldata from the store
|
||||||
|
game.system.rdd.combatStore.attaques[data.attackerId] = undefined;
|
||||||
|
game.system.rdd.combatStore.defenses[attackerRoll.passeArme] = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static _sendRollMessage(sender, recipient, defenderTokenId, topic, message, rollData) {
|
static _sendRollMessage(sender, recipient, defenderTokenId, topic, message, rollData) {
|
||||||
let chatMessage = {
|
let chatMessage = {
|
||||||
@ -129,7 +217,7 @@ export class RdDCombat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async onEvent(button, event) {
|
async onEvent(button, event) {
|
||||||
let attackerRoll = game.system.rdd.rollDataHandler.attaques[this.attackerId];
|
let attackerRoll = game.system.rdd.combatStore.attaques[this.attackerId];
|
||||||
if (!attackerRoll) {
|
if (!attackerRoll) {
|
||||||
ui.notifications.warn("Action automatisée impossible, le jet de l'attaquant a été perdu (suite à un raffraichissement?)")
|
ui.notifications.warn("Action automatisée impossible, le jet de l'attaquant a été perdu (suite à un raffraichissement?)")
|
||||||
return;
|
return;
|
||||||
@ -163,18 +251,18 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_consumeDefense(passeArme) {
|
_consumeDefense(passeArme) {
|
||||||
let defenderRoll = this._getDefense(passeArme);
|
let defenderRoll = this._getDefense(passeArme);
|
||||||
game.system.rdd.rollDataHandler.defenses[passeArme] = undefined;
|
game.system.rdd.combatStore.defenses[passeArme] = undefined;
|
||||||
return defenderRoll;
|
return defenderRoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_getDefense(passeArme) {
|
_getDefense(passeArme) {
|
||||||
return game.system.rdd.rollDataHandler.defenses[passeArme];
|
return game.system.rdd.combatStore.defenses[passeArme];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_storeDefense(defenderRoll) {
|
_storeDefense(defenderRoll) {
|
||||||
game.system.rdd.rollDataHandler.defenses[defenderRoll.passeArme] = defenderRoll;
|
game.system.rdd.combatStore.defenses[defenderRoll.passeArme] = defenderRoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -320,7 +408,7 @@ export class RdDCombat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onAttaqueParticuliere(rollData) {
|
async _onAttaqueParticuliere(rollData) {
|
||||||
game.system.rdd.rollDataHandler.attaques[this.attackerId] = duplicate(rollData);
|
game.system.rdd.combatStore.attaques[this.attackerId] = duplicate(rollData);
|
||||||
|
|
||||||
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
||||||
const isMeleeDiffNegative = rollData.selectedCarac.label == "Mêlée" && rollData.diffLibre < 0;
|
const isMeleeDiffNegative = rollData.selectedCarac.label == "Mêlée" && rollData.diffLibre < 0;
|
||||||
@ -342,7 +430,7 @@ export class RdDCombat {
|
|||||||
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar());
|
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker.getBonusDegat(), this.defender.isEntiteCauchemar());
|
||||||
|
|
||||||
// Save rollData for defender
|
// Save rollData for defender
|
||||||
game.system.rdd.rollDataHandler.attaques[this.attackerId] = duplicate(attackerRoll);
|
game.system.rdd.combatStore.attaques[this.attackerId] = duplicate(attackerRoll);
|
||||||
|
|
||||||
attackerRoll.show = {
|
attackerRoll.show = {
|
||||||
cible: this.target ? this.defender.data.name : 'la cible',
|
cible: this.target ? this.defender.data.name : 'la cible',
|
||||||
@ -401,7 +489,7 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onAttaqueEchecTotal(attackerRoll) {
|
async _onAttaqueEchecTotal(attackerRoll) {
|
||||||
|
|
||||||
game.system.rdd.rollDataHandler.attaques[this.attackerId] = duplicate(attackerRoll);
|
game.system.rdd.combatStore.attaques[this.attackerId] = duplicate(attackerRoll);
|
||||||
|
|
||||||
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
// Finesse et Rapidité seulement en mêlée et si la difficulté libre est de -1 minimum
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
@ -755,8 +843,9 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayActorCombatStatus(actor) {
|
static async displayActorCombatStatus(combat, actor) {
|
||||||
let rollData = {
|
let data = {
|
||||||
|
combatId: combat._id,
|
||||||
alias: actor.name,
|
alias: actor.name,
|
||||||
etatGeneral: actor.getEtatGeneral(),
|
etatGeneral: actor.getEtatGeneral(),
|
||||||
isSonne: actor.getSonne(),
|
isSonne: actor.getSonne(),
|
||||||
@ -767,22 +856,14 @@ export class RdDCombat {
|
|||||||
isCritique: false
|
isCritique: false
|
||||||
}
|
}
|
||||||
if (actor.countBlessuresByName("critiques") > 0) { // Pour éviter le cumul grave + critique
|
if (actor.countBlessuresByName("critiques") > 0) { // Pour éviter le cumul grave + critique
|
||||||
rollData.isCritique = true;
|
data.isCritique = true;
|
||||||
} else if (actor.countBlessuresByName("graves") > 0) {
|
} else if (actor.countBlessuresByName("graves") > 0) {
|
||||||
rollData.isGrave = true;
|
data.isGrave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatUtility.createChatWithRollMode(actor.name, {
|
ChatUtility.createChatWithRollMode(actor.name, {
|
||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, data)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
static updateCombatRound(combat, data) {
|
|
||||||
if (combat.data.round != 0 && combat.turns && combat.data.active) {
|
|
||||||
let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId);
|
|
||||||
this.displayActorCombatStatus(turn.actor);
|
|
||||||
// TODO Playaudio ??
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -103,13 +103,8 @@ Hooks.once("init", async function() {
|
|||||||
|
|
||||||
// preload handlebars templates
|
// preload handlebars templates
|
||||||
RdDUtility.preloadHandlebarsTemplates();
|
RdDUtility.preloadHandlebarsTemplates();
|
||||||
|
|
||||||
// Create useful storage space
|
// Create useful storage space
|
||||||
game.system.rdd = {
|
game.system.rdd = {
|
||||||
rollDataHandler: {
|
|
||||||
attaques: {},
|
|
||||||
defenses: {}
|
|
||||||
},
|
|
||||||
TMRUtility: TMRUtility
|
TMRUtility: TMRUtility
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +185,8 @@ Hooks.once("init", async function() {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
game.socket.on("system.foundryvtt-reve-de-dragon", data => {
|
game.socket.on("system.foundryvtt-reve-de-dragon", data => {
|
||||||
RdDUtility.performSocketMesssage( data );
|
RdDUtility.onSocketMesssage(data);
|
||||||
|
RdDCombat.onSocketMessage(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -208,7 +204,8 @@ Hooks.once("init", async function() {
|
|||||||
Actors.unregisterSheet("core", ActorSheet);
|
Actors.unregisterSheet("core", ActorSheet);
|
||||||
Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorSheet, {
|
Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorSheet, {
|
||||||
types: ["personnage"],
|
types: ["personnage"],
|
||||||
makeDefault: true }
|
makeDefault: true
|
||||||
|
}
|
||||||
);
|
);
|
||||||
Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorCreatureSheet, {
|
Actors.registerSheet("foundryvtt-reve-de-dragon", RdDActorCreatureSheet, {
|
||||||
types: ["creature"],
|
types: ["creature"],
|
||||||
@ -230,6 +227,11 @@ Hooks.once("init", async function() {
|
|||||||
|
|
||||||
// Patch the initiative formula
|
// Patch the initiative formula
|
||||||
_patch_initiative();
|
_patch_initiative();
|
||||||
|
|
||||||
|
// préparation des différents modules
|
||||||
|
RdDCommands.init();
|
||||||
|
RdDCombat.init();
|
||||||
|
RdDTokenHud.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -244,18 +246,10 @@ function messageDeBienvenue(){
|
|||||||
` });
|
` });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
Hooks.once("renderApplication", () => {
|
|
||||||
messageDeBienvenue();
|
|
||||||
});
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Foundry VTT Initialization */
|
/* Foundry VTT Initialization */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
Hooks.once("ready", function () {
|
Hooks.once("ready", function () {
|
||||||
|
|
||||||
// préparation des lignes de commandes
|
|
||||||
RdDCommands.init();
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Affiche/Init le calendrier */
|
/* Affiche/Init le calendrier */
|
||||||
let calendrier = new RdDCalendrier();
|
let calendrier = new RdDCalendrier();
|
||||||
@ -270,14 +264,14 @@ Hooks.once("ready", function() {
|
|||||||
// Avertissement si joueur sans personnage
|
// Avertissement si joueur sans personnage
|
||||||
if (!game.user.isGM && game.user.character == undefined) {
|
if (!game.user.isGM && game.user.character == undefined) {
|
||||||
ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !");
|
ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !");
|
||||||
ChatMessage.create( { content:"<b>ATTENTION</b> Le joueur " + game.user.name + " n'est connecté à aucun personnage !",
|
ChatMessage.create({
|
||||||
user: game.user._id } );
|
content: "<b>ATTENTION</b> Le joueur " + game.user.name + " n'est connecté à aucun personnage !",
|
||||||
|
user: game.user._id
|
||||||
|
});
|
||||||
//whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
|
//whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Integration du TokenHUD
|
messageDeBienvenue();
|
||||||
Hooks.on('renderTokenHUD', (app, html, data) => { RdDTokenHud.addTokenHudExtensions(app, html, data._id) });
|
|
||||||
Hooks.on("updateCombat", (combat, data) => { RdDCombat.updateCombatRound(combat, data) } );
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -5,6 +5,11 @@ import { RdDUtility } from "./rdd-utility.js";
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class RdDTokenHud {
|
export class RdDTokenHud {
|
||||||
|
|
||||||
|
static init(){
|
||||||
|
// Integration du TokenHUD
|
||||||
|
Hooks.on('renderTokenHUD', (app, html, data) => { RdDTokenHud.addTokenHudExtensions(app, html, data._id) });
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async removeExtensionHud( app, html, tokenId) {
|
static async removeExtensionHud( app, html, tokenId) {
|
||||||
let combat = html.find('.control-icon.rdd-combat');
|
let combat = html.find('.control-icon.rdd-combat');
|
||||||
|
@ -629,13 +629,11 @@ export class RdDUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static performSocketMesssage(sockmsg) {
|
static onSocketMesssage(sockmsg) {
|
||||||
console.log(">>>>> MSG RECV", sockmsg);
|
console.log(">>>>> MSG RECV", sockmsg);
|
||||||
switch (sockmsg.msg) {
|
switch (sockmsg.msg) {
|
||||||
case "msg_encaisser":
|
case "msg_encaisser":
|
||||||
return RdDUtility._handleMsgEncaisser(sockmsg.data);
|
return RdDUtility._handleMsgEncaisser(sockmsg.data);
|
||||||
case "msg_defense":
|
|
||||||
return RdDUtility._handleMsgDefense(sockmsg.data);
|
|
||||||
case "msg_gm_chat_message":
|
case "msg_gm_chat_message":
|
||||||
return ChatUtility.handleGMChatMessage(sockmsg.data);
|
return ChatUtility.handleGMChatMessage(sockmsg.data);
|
||||||
case "msg_sync_time":
|
case "msg_sync_time":
|
||||||
@ -647,25 +645,6 @@ export class RdDUtility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
static _handleMsgDefense(data) {
|
|
||||||
let defenderToken = canvas.tokens.get(data.defenderTokenId);
|
|
||||||
if (defenderToken) {
|
|
||||||
if (!game.user.isGM && game.user.character == undefined) { // vérification / sanity check
|
|
||||||
ui.notifications.error("Le joueur " + game.user.name + " n'est connecté à aucun personnage. Impossible de continuer.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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.attaques[data.attackerId] = duplicate(data.rollData);
|
|
||||||
data.whisper = [game.user];
|
|
||||||
data.blind = true;
|
|
||||||
data.rollMode = "blindroll";
|
|
||||||
ChatMessage.create(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static rollInitiativeCompetence(combatantId, arme) {
|
static rollInitiativeCompetence(combatantId, arme) {
|
||||||
const combatant = game.combat.getCombatant(combatantId);
|
const combatant = game.combat.getCombatant(combatantId);
|
||||||
@ -760,12 +739,9 @@ export class RdDUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static _handleMsgEncaisser(data) {
|
static _handleMsgEncaisser(data) {
|
||||||
if (game.user.isGM) { // Seul le GM effectue l'encaissement sur la fiche
|
if (game.user.isGM) { // Seul le GM effectue l'encaissement sur la fiche
|
||||||
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;
|
let defender = canvas.tokens.get(data.defenderTokenId).actor;
|
||||||
defender.encaisserDommages(attackerRoll);
|
let attacker = data.attackerId ? game.actors.get(data.attackerId) : null;
|
||||||
|
defender.encaisserDommages(attackerRoll, attacker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +241,18 @@ table {border: 1px solid #7a7971;}
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button-img {
|
.button-img {
|
||||||
|
vertical-align: baseline;
|
||||||
width: 8%;
|
width: 8%;
|
||||||
height: 8%;
|
height: 8%;
|
||||||
|
max-height: 48px;
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-effect-img {
|
||||||
|
vertical-align: baseline;
|
||||||
|
width: 16px;
|
||||||
|
max-height: 16px;
|
||||||
|
height: 16;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,12 +263,6 @@ table {border: 1px solid #7a7971;}
|
|||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
.img-sonne {
|
|
||||||
vertical-align: baseline;
|
|
||||||
max-height: 16px;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.foundryvtt-reve-de-dragon .sheet-header .header-fields {
|
.foundryvtt-reve-de-dragon .sheet-header .header-fields {
|
||||||
-webkit-box-flex: 1;
|
-webkit-box-flex: 1;
|
||||||
-ms-flex: 1;
|
-ms-flex: 1;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<label class="ctn-sonne">
|
<label class="ctn-sonne">
|
||||||
Sonné :
|
Sonné :
|
||||||
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
|
<input class="resource-content" type="checkbox" name="data.sante.sonne.value" value="{{data.sante.sonne.value}}" {{#if data.sante.sonne.value}}checked{{/if}} />
|
||||||
<img class="img-sonne" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
|
<img class="button-effect-img" {{#if data.sante.sonne.value}}style="opacity: 1;"{{else}}style="opacity: 0;"{{/if}} src="icons/svg/stoned.svg" height="16" width="16"/>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<h4>C'est au tour de {{alias}} !</h4>
|
<h4>C'est au tour de {{alias}} !</h4>
|
||||||
<div>{{blessuresStatus}}</div>
|
<div data-combatid="{{combatId}}" data-combatmessage="actor-turn-summary">{{blessuresStatus}}</div>
|
||||||
<div>Son état général est de : {{etatGeneral}} {{#if isSonne}} et est <strong>sonné</strong>{{/if}}</div>
|
<div>Son état général est de : {{etatGeneral}} {{#if isSonne}} et est <strong>sonné</strong>{{/if}}</div>
|
||||||
{{#if isGrave}}
|
{{#if isGrave}}
|
||||||
<div>{{alias}} souffre de Blessure(s) Grave(s) : n'oubliez pas de faire un Je de Vie toutes les SC ({{SConst}}) minutes.</div>
|
<div>{{alias}} souffre de Blessure(s) Grave(s) : n'oubliez pas de faire un Je de Vie toutes les SC ({{SConst}}) minutes.</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user