Fix empoignade

- les items d'empoignade sont ajoutés par le MJ
- les caractéristiques du défenseur sont utilisées pour la défense
- la difficulté d'attaque est imposée au défenseur
- les particulières sont en finesse (p133)
This commit is contained in:
Vincent Vandemeulebrouck 2023-06-14 22:25:11 +02:00
parent d35e47824d
commit 804fa3b784
13 changed files with 166 additions and 120 deletions

View File

@ -273,24 +273,24 @@ export class RdDActor extends RdDBaseActor {
getDraconicOuPossession() { getDraconicOuPossession() {
const possession = this.items.filter(it => it.type == TYPES.competencecreature && it.system.categorie == 'possession') const possession = this.items.filter(it => it.type == TYPES.competencecreature && it.system.categorie == 'possession')
.sort(Misc.descending(it => it.system.niveau)) .sort(Misc.descending(it => it.system.niveau))
.find(it=>true); .find(it => true);
if (possession) { if (possession) {
return possession.clone(); return possession.clone();
} }
const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0).map(it =>it.clone()), const draconics = [...this.getDraconicList().filter(it => it.system.niveau >= 0).map(it => it.clone()),
POSSESSION_SANS_DRACONIC] POSSESSION_SANS_DRACONIC]
.sort(Misc.descending(it => it.system.niveau)); .sort(Misc.descending(it => it.system.niveau));
return draconics[0]; return draconics[0];
} }
getPossession(possessionId) { getPossession(possessionId) {
return this.items.find(it => it.type == 'possession' && it.system.possessionid == possessionId); return this.items.find(it => it.type == TYPES.possession && it.system.possessionid == possessionId);
} }
getPossessions() { getPossessions() {
return this.items.filter(it => it.type == 'possession'); return this.items.filter(it => it.type == TYPES.possession);
} }
getEmpoignades() { getEmpoignades() {
return this.items.filter(it => it.type == 'empoignade'); return this.items.filter(it => it.type == TYPES.empoignade);
} }
getDemiReve() { getDemiReve() {
return this.system.reve.tmrpos.coord; return this.system.reve.tmrpos.coord;
@ -1362,21 +1362,38 @@ export class RdDActor extends RdDBaseActor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async finDeRound(options = { terminer: false }) { async finDeRound(options = { terminer: false }) {
await this.$finDeRoundSuppressionEffetsTermines(options);
await this.$finDeRoundBlessuresGraves();
await this.$finDeRoundSupprimerObsoletes();
}
async $finDeRoundSuppressionEffetsTermines(options) {
for (let effect of this.getEffects()) { for (let effect of this.getEffects()) {
if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) { if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) {
await effect.delete(); await effect.delete();
ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` }); ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` });
} }
} }
}
async $finDeRoundBlessuresGraves() {
if (this.isPersonnage() || this.isCreature()) { if (this.isPersonnage() || this.isCreature()) {
const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length;
if (nbGraves > 0) { if (nbGraves > 0) {
// Gestion blessure graves : -1 pt endurance par blessure grave // Gestion blessure graves : -1 pt endurance par blessure grave
await this.santeIncDec("endurance", - nbGraves); await this.santeIncDec("endurance", -nbGraves);
} }
} }
} }
async $finDeRoundSupprimerObsoletes() {
const obsoletes = []
.concat(this.itemTypes[TYPES.empoignade].filter(it => it.system.pointsemp <= 0))
.concat(this.itemTypes[TYPES.possession].filter(it => it.system.compteur < -2 || it.system.compteur > 2))
.map(it => it.id);
await this.deleteEmbeddedDocuments('Item', obsoletes);
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async setSonne(sonne = true) { async setSonne(sonne = true) {
if (this.isEntite()) { if (this.isEntite()) {

View File

@ -144,6 +144,18 @@ export class RdDBaseActor extends Actor {
.forEach(async it => await it.onFinPeriodeTemporel(oldTimestamp, newTimestamp)) .forEach(async it => await it.onFinPeriodeTemporel(oldTimestamp, newTimestamp))
} }
async creerObjetParMJ(object){
if (!Misc.isUniqueConnectedGM()) {
RdDBaseActor.remoteActorCall({
actorId: this.id,
method: 'creerObjetParMJ',
args: [object]
});
return;
}
await this.createEmbeddedDocuments('Item', [object])
}
/* -------------------------------------------- */ /* -------------------------------------------- */
getFortune() { getFortune() {
return Monnaie.getFortune(this.itemTypes['monnaie']); return Monnaie.getFortune(this.itemTypes['monnaie']);

View File

@ -78,11 +78,7 @@ export class ChatUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async createChatWithRollMode(name, chatOptions) { static async createChatWithRollMode(name, chatOptions) {
return await ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions); let rollMode = game.settings.get("core", "rollMode")
}
/* -------------------------------------------- */
static async createChatMessage(name, rollMode, chatOptions) {
switch (rollMode) { switch (rollMode) {
case "blindroll": // GM only case "blindroll": // GM only
if (!game.user.isGM) { if (!game.user.isGM) {

View File

@ -4,6 +4,8 @@ import { RdDRoll } from "./rdd-roll.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { STATUSES } from "./settings/status-effects.js"; import { STATUSES } from "./settings/status-effects.js";
import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { TYPES } from "./item.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -14,6 +16,47 @@ export class RdDEmpoignade {
static init() { static init() {
} }
/* -------------------------------------------- */
static registerChatCallbacks(html) {
html.on("click", '.defense-empoignade-cac', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.readRollEmpoignade(chatMessage);
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Corps à corps", "melee")
});
html.on("click", '.defense-empoignade-esquive', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.readRollEmpoignade(chatMessage);
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Esquive", "derobee")
});
html.on("click", '.empoignade-poursuivre', event => {
let attackerId = event.currentTarget.attributes['data-attackerId'].value
let defenderId = event.currentTarget.attributes['data-defenderId'].value
RdDEmpoignade.onAttaqueEmpoignadeValidee(game.actors.get(attackerId), game.actors.get(defenderId))
});
html.on("click", '.empoignade-entrainer-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.readRollEmpoignade(chatMessage);
RdDEmpoignade.entrainerAuSol(rollData)
ChatUtility.removeChatMessageId(chatMessage.id)
});
html.on("click", '.empoignade-projeter-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.readRollEmpoignade(chatMessage);
RdDEmpoignade.projeterAuSol(rollData)
ChatUtility.removeChatMessageId(chatMessage.id)
});
html.on("change", '.empoignade-perte-endurance', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = RdDEmpoignade.readRollEmpoignade(chatMessage);
if (event.currentTarget.value && event.currentTarget.value != "none") {
RdDEmpoignade.perteEndurance(rollData, event.currentTarget.value)
ChatUtility.removeChatMessageId(chatMessage.id)
}
});
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static checkEmpoignadeEnCours(actor) { static checkEmpoignadeEnCours(actor) {
// TODO: autoriser la perception? la comédie/séduction? // TODO: autoriser la perception? la comédie/séduction?
@ -24,23 +67,38 @@ export class RdDEmpoignade {
return false; return false;
} }
/* -------------------------------------------- */
static storeRollEmpoignade(msg, rollData) {
rollData.attacker = { id: rollData.attacker.id }
rollData.defender = { id: rollData.defender.id }
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData);
}
/* -------------------------------------------- */
static readRollEmpoignade(msg) {
const rollData = ChatUtility.getMessageData(msg, 'empoignade-roll-data');
rollData.attacker = game.actors.get(rollData.attacker.id)
rollData.defender = game.actors.get(rollData.defender.id)
return rollData
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static isEmpoignadeEnCours(actor) { static isEmpoignadeEnCours(actor) {
return actor.itemTypes['empoignade'].find(it => it.system.pointsemp > 0) return actor.itemTypes[TYPES.empoignade].find(it => it.system.pointsemp > 0)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getEmpoignadeById(actor, id) { static getEmpoignadeById(actor, id) {
let emp = actor.itemTypes['empoignade'].find(it => it.system.empoignadeid == id) let emp = actor.itemTypes[TYPES.empoignade].find(it => it.system.empoignadeid == id)
return emp && duplicate(emp) || undefined; return emp && duplicate(emp) || undefined;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getEmpoignade(attacker, defender) { static getEmpoignade(attacker, defender) {
let emp = attacker.itemTypes['empoignade'].find(it => it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id) let emp = attacker.itemTypes[TYPES.empoignade].find(it =>
if (!emp) { (it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id) ||
emp = attacker.itemTypes['empoignade'].find(it => it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id) (it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
} )
if (emp) { if (emp) {
return duplicate(emp); return duplicate(emp);
} }
@ -68,15 +126,10 @@ export class RdDEmpoignade {
let mode = (empoignade && empoignade.system.empoigneurid == attacker.id) ? "empoigner" : "liberer" let mode = (empoignade && empoignade.system.empoigneurid == attacker.id) ? "empoigner" : "liberer"
let rollData = { let rollData = {
mode: mode, mode, empoignade, attacker, defender,
isEmpoignade: true, isEmpoignade: true,
competence: attacker.getCompetence("Corps à corps").clone(), competence: attacker.getCompetence("Corps à corps").clone(),
selectedCarac: attacker.system.carac.melee, selectedCarac: attacker.system.carac.melee,
empoignade: empoignade,
attackerId: attacker.id,
attackerName: attacker.name,
defenderName: defender.name,
defenderId: defender.id,
malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender) malusTaille: RdDEmpoignade.getMalusTaille(empoignade, attacker, defender)
} }
if (attacker.isCreatureEntite()) { if (attacker.isCreatureEntite()) {
@ -84,7 +137,7 @@ export class RdDEmpoignade {
} }
if (empoignade.system.pointsemp >= 2) { if (empoignade.system.pointsemp >= 2) {
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-actions.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-actions.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} else { } else {
await RdDEmpoignade.$rollAttaqueEmpoignade(attacker, rollData, isNouvelle); await RdDEmpoignade.$rollAttaqueEmpoignade(attacker, rollData, isNouvelle);
} }
@ -119,35 +172,36 @@ export class RdDEmpoignade {
{ {
name: 'jet-empoignade', name: 'jet-empoignade',
label: 'Empoigner', label: 'Empoigner',
callbacks: [ callbacks: [{ action: async (r) => await RdDEmpoignade.$onRollEmpoignade(r, isNouvelle) },]
{ condition: r => (r.rolled.isSuccess), action: async (r) => await RdDEmpoignade.$onRollEmpoignade(r, true, isNouvelle) },
{ condition: r => (r.rolled.isEchec), action: async (r) => await RdDEmpoignade.$onRollEmpoignade(r, false, isNouvelle) },
]
}); });
dialog.render(true); dialog.render(true);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async $onRollEmpoignade(rollData, isSuccess, isNouvelle = false) { static async $onRollEmpoignade(rollData, isNouvelle = false) {
let attacker = game.actors.get(rollData.attackerId) let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defenderId) let defender = game.actors.get(rollData.defender.id)
let empoignade = rollData.empoignade
empoignade.isSuccess = isSuccess;
if (isSuccess && isNouvelle) { if (rollData.rolled.isSuccess && isNouvelle) {
const objectEmpoignade = rollData.empoignade.toObject();
// Creer l'empoignade sur attaquant/defenseur // Creer l'empoignade sur attaquant/defenseur
await attacker.createEmbeddedDocuments('Item', [empoignade.toObject()]) attacker.creerObjetParMJ(objectEmpoignade);
await defender.createEmbeddedDocuments('Item', [empoignade.toObject()]) defender.creerObjetParMJ(objectEmpoignade);
}
rollData.empoignade.isSuccess = rollData.rolled.isSuccess;
if (rollData.rolled.isPart) {
rollData.particuliere = "finesse";
} }
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-resultat.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-resultat.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async onDefenseEmpoignade(rollData, defenseMode, competenceName = "Corps à corps", carac = "melee") { static async onDefenseEmpoignade(attackerRoll, mode, competenceName = "Corps à corps", carac = "melee") {
let attacker = game.actors.get(rollData.attackerId) let attacker = game.actors.get(attackerRoll.attacker.id)
let defender = game.actors.get(rollData.defenderId) let defender = game.actors.get(attackerRoll.defender.id)
let empoignade = this.getEmpoignade(attacker, defender) let empoignade = this.getEmpoignade(attacker, defender)
if (!empoignade) { if (!empoignade) {
@ -156,13 +210,18 @@ export class RdDEmpoignade {
} }
empoignade = duplicate(empoignade) empoignade = duplicate(empoignade)
rollData.mode = defenseMode let defenderRoll = {
rollData.empoignade = empoignade mode, attacker, defender, empoignade, attackerRoll,
rollData.competence = defender.getCompetence(competenceName), diffLibre: attackerRoll.diffLibre,
rollData.selectedCarac = defender.system.carac[carac], attaqueParticuliere: attackerRoll.particuliere,
rollData.malusTaille = RdDEmpoignade.getMalusTaille(empoignade, defender, attacker) competence: defender.getCompetence(competenceName).clone(),
surprise: defender.getSurprise(true),
await RdDEmpoignade.$rollDefenseEmpoignade(defender, rollData); carac: defender.system.carac,
selectedCarac: defender.system.carac[carac],
malusTaille: RdDEmpoignade.getMalusTaille(empoignade, defender, attacker),
show: {}
};
await RdDEmpoignade.$rollDefenseEmpoignade(defender, defenderRoll);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -196,7 +255,7 @@ export class RdDEmpoignade {
if (empoignade.system.pointsemp >= 2) { if (empoignade.system.pointsemp >= 2) {
let attacker = game.actors.get(empoignade.system.empoigneurid) let attacker = game.actors.get(empoignade.system.empoigneurid)
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-actions.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-actions.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} }
await RdDResolutionTable.displayRollData(rollData, rollData.defender, 'chat-empoignade-resultat.html') await RdDResolutionTable.displayRollData(rollData, rollData.defender, 'chat-empoignade-resultat.html')
} }
@ -231,8 +290,8 @@ export class RdDEmpoignade {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async entrainerAuSol(rollData) { static async entrainerAuSol(rollData) {
let attacker = game.actors.get(rollData.attackerId) let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defenderId) let defender = game.actors.get(rollData.defender.id)
let empoignade = this.getEmpoignade(attacker, defender) let empoignade = this.getEmpoignade(attacker, defender)
empoignade.system.ausol = true empoignade.system.ausol = true
@ -242,25 +301,25 @@ export class RdDEmpoignade {
await defender.setEffect(STATUSES.StatusProne, true); await defender.setEffect(STATUSES.StatusProne, true);
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-entrainer-sol.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async projeterAuSol(rollData) { static async projeterAuSol(rollData) {
let attacker = game.actors.get(rollData.attackerId) let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defenderId) let defender = game.actors.get(rollData.defender.id)
let empoignade = this.getEmpoignade(attacker, defender) let empoignade = this.getEmpoignade(attacker, defender)
await defender.setEffect(STATUSES.StatusProne, true); await defender.setEffect(STATUSES.StatusProne, true);
await this.$deleteEmpoignade(empoignade) await this.$deleteEmpoignade(empoignade)
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-projeter-sol.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-projeter-sol.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async perteEndurance(rollData, perteMode) { static async perteEndurance(rollData, perteMode) {
let attacker = game.actors.get(rollData.attackerId) let attacker = game.actors.get(rollData.attacker.id)
let defender = game.actors.get(rollData.defenderId) let defender = game.actors.get(rollData.defender.id)
let empoignade = this.getEmpoignade(attacker, defender) let empoignade = this.getEmpoignade(attacker, defender)
//console.log("Perte d'endurance :!!!", perteMode) //console.log("Perte d'endurance :!!!", perteMode)
@ -278,7 +337,7 @@ export class RdDEmpoignade {
await defender.santeIncDec("endurance", -(3 * Math.floor(endValue / 4))); await defender.santeIncDec("endurance", -(3 * Math.floor(endValue / 4)));
} }
let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.html'); let msg = await RdDResolutionTable.displayRollData(rollData, attacker, 'chat-empoignade-perte-endurance.html');
ChatUtility.setMessageData(msg, "empoignade-roll-data", rollData) RdDEmpoignade.storeRollEmpoignade(msg, rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -91,13 +91,17 @@ export class RdDResolutionTable {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') { static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
return await ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, { return await ChatUtility.createChatWithRollMode(RdDResolutionTable.actorChatName(actor), {
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template) content: await RdDResolutionTable.buildRollDataHtml(rollData, template)
}); });
} }
static actorChatName(actor) {
return actor?.userName ?? game.user.name;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async buildRollDataHtml(rollData, actor, template = 'chat-resultat-general.html') { static async buildRollDataHtml(rollData, template = 'chat-resultat-general.html') {
rollData.show = rollData.show || {}; rollData.show = rollData.show || {};
return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData); return await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/${template}`, rollData);
} }

View File

@ -668,6 +668,7 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async chatListeners(html) { static async chatListeners(html) {
RdDCombat.registerChatCallbacks(html); RdDCombat.registerChatCallbacks(html);
RdDEmpoignade.registerChatCallbacks(html);
// Gestion spécifique message passeurs // Gestion spécifique message passeurs
html.on("click", '.tmr-passeur-coord a', event => { html.on("click", '.tmr-passeur-coord a', event => {
@ -694,44 +695,6 @@ export class RdDUtility {
RdDPossession.onDefensePossession(attackerId, defenderId, possessionId) RdDPossession.onDefensePossession(attackerId, defenderId, possessionId)
}); });
html.on("click", '.defense-empoignade-cac', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = ChatUtility.getMessageData(chatMessage, 'empoignade-roll-data');
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Corps à corps", "melee")
});
html.on("click", '.defense-empoignade-esquive', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = ChatUtility.getMessageData(chatMessage, 'empoignade-roll-data');
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
RdDEmpoignade.onDefenseEmpoignade(rollData, defenseMode, "Esquive", "derobee")
});
html.on("click", '.empoignade-poursuivre', event => {
let attackerId = event.currentTarget.attributes['data-attackerId'].value
let defenderId = event.currentTarget.attributes['data-defenderId'].value
RdDEmpoignade.onAttaqueEmpoignadeValidee(game.actors.get(attackerId), game.actors.get(defenderId))
});
html.on("click", '.empoignade-entrainer-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = ChatUtility.getMessageData(chatMessage, 'empoignade-roll-data');
RdDEmpoignade.entrainerAuSol(rollData)
ChatUtility.removeChatMessageId(chatMessage.id)
});
html.on("click", '.empoignade-projeter-sol', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = ChatUtility.getMessageData(chatMessage, 'empoignade-roll-data');
RdDEmpoignade.projeterAuSol(rollData)
ChatUtility.removeChatMessageId(chatMessage.id)
});
html.on("change", '.empoignade-perte-endurance', event => {
const chatMessage = ChatUtility.getChatMessage(event);
const rollData = ChatUtility.getMessageData(chatMessage, 'empoignade-roll-data');
if (event.currentTarget.value && event.currentTarget.value != "none") {
RdDEmpoignade.perteEndurance(rollData, event.currentTarget.value)
ChatUtility.removeChatMessageId(chatMessage.id)
}
});
// gestion bouton tchat Acheter // gestion bouton tchat Acheter
html.on("click", '.button-acheter', event => { html.on("click", '.button-acheter', event => {
const venteData = DialogItemAchat.preparerAchat(event.currentTarget); const venteData = DialogItemAchat.preparerAchat(event.currentTarget);

View File

@ -1,12 +1,12 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{attackerName}} a empoigné {{defenderName}} {{attacker.name}} a empoigné {{defender.name}}
</h4> </h4>
<hr> <hr>
<div> <div>
<span class='chat-card-button-area'> <span class='chat-card-button-area'>
Au round suivant l'acquisition des 2 points d'Emp, {{attackerName}} peut faire perdre autant de points d'Endurance qu'il souhaite à {{defenderName}} Au round suivant l'acquisition des 2 points d'Emp, {{attacker.name}} peut faire perdre autant de points d'Endurance qu'il souhaite à {{defender.name}}
<br> <br>
<a class='empoignade-perte-endurance chat-card-button'> <a class='empoignade-perte-endurance chat-card-button'>
<select class='empoignade-perte-endurance'> <select class='empoignade-perte-endurance'>
@ -22,13 +22,13 @@
{{else}} {{else}}
<br> <br>
Dès l'acquisition des 2 points d'Emp, {{attackerName}} peut entraîner {{defenderName}} au sol. Les deux protagonistes restent empoignés. Dès l'acquisition des 2 points d'Emp, {{attacker.name}} peut entraîner {{defender.name}} au sol. Les deux protagonistes restent empoignés.
<br> <br>
<a class='empoignade-entrainer-sol chat-card-button'> <a class='empoignade-entrainer-sol chat-card-button'>
Entraîner au sol Entraîner au sol
</a> </a>
<br> <br>
A la fin du round ou les 2 points d'Emp sont acquis, {{attackerName}} peut projeter {{defenderName}} au sol. Les deux protagonistes ne sont plus empoignés. A la fin du round ou les 2 points d'Emp sont acquis, {{attacker.name}} peut projeter {{defender.name}} au sol. Les deux protagonistes ne sont plus empoignés.
<br> <br>
<a class='empoignade-projeter-sol chat-card-button'> <a class='empoignade-projeter-sol chat-card-button'>
Projeter au sol Projeter au sol

View File

@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{attackerName}} a entraîné {{defenderName}} au sol. L'empoignade peut continuer. {{attacker.name}} a entraîné {{defender.name}} au sol. L'empoignade peut continuer.
</h4> </h4>
<hr> <hr>
<div> <div>

View File

@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{attackerName}} a fait perdre de l'endurance à {{defenderName}}, qui reste immobilisé. L'empoignade peut continuer. {{attacker.name}} a fait perdre de l'endurance à {{defender.name}}, qui reste immobilisé. L'empoignade peut continuer.
</h4> </h4>
<hr> <hr>
<div> <div>

View File

@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{attackerName}} a projeté {{defenderName}} au sol. L'empoignade est terminée et a été supprimée. {{attacker.name}} a projeté {{defender.name}} au sol. L'empoignade est terminée et a été supprimée.
</h4> </h4>
<hr> <hr>
<div> <div>

View File

@ -1,16 +1,17 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{log 'rollData' this}}
{{#if (eq mode "empoigner")}} {{#if (eq mode "empoigner")}}
{{attackerName}} tente d'empoigner {{defenderName}} {{attacker.name}} tente d'empoigner {{defender.name}}
{{/if}} {{/if}}
{{#if (eq mode "contrer-empoigner")}} {{#if (eq mode "contrer-empoigner")}}
{{defenderName}} tente de contrer l'empoignade de {{attackerName}} {{defender.name}} tente de contrer l'empoignade de {{attacker.name}}
{{/if}} {{/if}}
{{#if (eq mode "liberer")}} {{#if (eq mode "liberer")}}
{{attackerName}} tente de se libérer de l'empoignade de {{defenderName}} {{attacker.name}} tente de se libérer de l'empoignade de {{defender.name}}
{{/if}} {{/if}}
{{#if (eq mode "contrer-liberer")}} {{#if (eq mode "contrer-liberer")}}
{{defenderName}} tente de contrer la libération de {{attackerName}} {{defender.name}} tente de contrer la libération de {{attacker.name}}
{{/if}} {{/if}}
</h4> </h4>
{{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/chat-infojet.html"}}
@ -20,7 +21,7 @@
{{#if (gte empoignade.system.pointsemp 2)}} {{#if (gte empoignade.system.pointsemp 2)}}
<br><strong>{{defenderName}} est empoigné et immobilisé par {{attackerName}} !</strong> <br><strong>{{defender.name}} est empoigné et immobilisé par {{attacker.name}} !</strong>
{{else}} {{else}}
<span class='chat-card-button-area'> <span class='chat-card-button-area'>
@ -29,16 +30,12 @@
{{#if (eq mode "empoigner")}} {{#if (eq mode "empoigner")}}
{{#if empoignade.isSuccess}} {{#if empoignade.isSuccess}}
<a class='defense-empoignade-cac chat-card-button' <a class='defense-empoignade-cac chat-card-button'
data-attackerId='{{attacker.id}}'
data-defenderId='{{defender.id}}'
data-diff-libre='{{diffLibre}}' data-diff-libre='{{diffLibre}}'
data-defense-mode="contrer-empoigner"> data-defense-mode="contrer-empoigner">
Contrer l'empoignade (Corps à Corps) Contrer l'empoignade (Corps à Corps)
</a> </a>
{{#if (eq empoignade.system.pointsemp 0)}} {{#if (eq empoignade.system.pointsemp 0)}}
<a class='defense-empoignade-esquive chat-card-button' <a class='defense-empoignade-esquive chat-card-button'
data-attackerId='{{attacker.id}}'
data-defenderId='{{defender.id}}'
data-diff-libre='{{diffLibre}}' data-diff-libre='{{diffLibre}}'
data-defense-mode="contrer-empoigner"> data-defense-mode="contrer-empoigner">
Contrer l'empoignade (Esquive) Contrer l'empoignade (Esquive)
@ -52,8 +49,6 @@
{{#if (eq mode "liberer")}} {{#if (eq mode "liberer")}}
{{#if empoignade.isSuccess}} {{#if empoignade.isSuccess}}
<a class='defense-empoignade-cac chat-card-button' <a class='defense-empoignade-cac chat-card-button'
data-attackerId='{{attacker.id}}'
data-defenderId='{{defender.id}}'
data-diff-libre='{{diffLibre}}' data-diff-libre='{{diffLibre}}'
data-defense-mode="contrer-liberer"> data-defense-mode="contrer-liberer">
Contrer la libération (Corps à Corps) Contrer la libération (Corps à Corps)

View File

@ -1,6 +1,6 @@
<img class="chat-icon" src="{{competence.img}}" /> <img class="chat-icon" src="{{competence.img}}" />
<h4> <h4>
{{attackerName}} tente d'empoigner {{defenderName}} {{attacker.name}} tente d'empoigner {{defender.name}}
</h4> </h4>
<hr> <hr>
<div> <div>

View File

@ -1,6 +1,6 @@
<form class="skill-roll-dialog"> <form class="skill-roll-dialog">
<h2> <h2>
{{defenderName}} tente de contrer l'empoignade de {{attackerName}} {{defender.name}} tente de contrer l'empoignade de {{attacker.name}}
</h2> </h2>
<div class="grid grid-2col"> <div class="grid grid-2col">
<div class="flex-group-left"> <div class="flex-group-left">