Merge branch 'amelioration-encaissement' into 'v1.2'
#100 Amélioration messages encaissement See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!109
This commit is contained in:
commit
0290b182ca
1199
module/actor.js
1199
module/actor.js
File diff suppressed because it is too large
Load Diff
@ -3,21 +3,20 @@
|
||||
* Class providing helper methods to get the list of users, and
|
||||
*/
|
||||
export class ChatUtility {
|
||||
/* -------------------------------------------- */
|
||||
static removeMyChatMessageContaining(part) {
|
||||
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
||||
.filter(it => it.data.content.includes(part));
|
||||
toDelete.forEach(it => it.delete());
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatWithRollMode(chatOptions, name) {
|
||||
let rollMode = game.settings.get("core", "rollMode");
|
||||
ChatUtility.createChatMessage(chatOptions, rollMode, name);
|
||||
static createChatWithRollMode(name, chatOptions) {
|
||||
ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatMessage(chatOptions, rollMode, name) {
|
||||
static createChatMessage(name, rollMode, chatOptions) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": // GM only
|
||||
if (!game.user.isGM) {
|
||||
|
@ -136,7 +136,6 @@ export class RdDCombat {
|
||||
}
|
||||
const defenderTokenId = event.currentTarget.attributes['data-defenderTokenId'].value;
|
||||
|
||||
let defenderRoll = this._getDefense(attackerRoll.passeArme);
|
||||
const armeParadeId = event.currentTarget.attributes['data-armeid']?.value;
|
||||
|
||||
switch (button) {
|
||||
@ -150,13 +149,13 @@ export class RdDCombat {
|
||||
() => this.attaqueChanceuse(attackerRoll),
|
||||
() => this._onEchecTotal(attackerRoll));
|
||||
case '#appel-chance-defense': return this.defender.rollAppelChance(
|
||||
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
||||
() => this.defenseChanceuse(attackerRoll),
|
||||
() => this.afficherOptionsDefense(attackerRoll, { defenseChance: true }));
|
||||
case '#appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||
() => this.attaqueSignificative(attackerRoll),
|
||||
() => { });
|
||||
case '#appel-destinee-defense': return this.defender.appelDestinee(
|
||||
() => this.defenseDestinee(defenderRoll),
|
||||
() => this.defenseDestinee(attackerRoll),
|
||||
() => { });
|
||||
}
|
||||
}
|
||||
@ -194,7 +193,7 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
defenseChanceuse(attackerRoll, defenderRoll) {
|
||||
defenseChanceuse(attackerRoll) {
|
||||
ui.notifications.info("La défense est rejouée grâce à la chance")
|
||||
attackerRoll.essais.defenseChance = true;
|
||||
attackerRoll.essais.defense = false;
|
||||
@ -203,15 +202,21 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
defenseDestinee(defenderRoll) {
|
||||
ui.notifications.info('Défense significative grâce à la destinée')
|
||||
RdDResolutionTable.forceSignificative(defenderRoll.rolled);
|
||||
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||
if (defenderRoll.arme) {
|
||||
this._onParadeNormale(defenderRoll);
|
||||
defenseDestinee(attackerRoll) {
|
||||
let defenderRoll = this._getDefense(attackerRoll.passeArme);
|
||||
if (defenderRoll) {
|
||||
ui.notifications.info('Défense significative grâce à la destinée')
|
||||
RdDResolutionTable.forceSignificative(defenderRoll.rolled);
|
||||
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||
if (defenderRoll.arme) {
|
||||
this._onParadeNormale(defenderRoll);
|
||||
}
|
||||
else {
|
||||
this._onEsquiveNormale(defenderRoll);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this._onEsquiveNormale(defenderRoll);
|
||||
ui.notifications.warn("Appel à la destinée impossible, la passe d'armes est déjà terminée!")
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,7 +228,7 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
removeChatMessageActionsPasseArme(passeArme) {
|
||||
if (game.settings.get("foundryvtt-reve-de-dragon", "supprimer-dialogues-combat-chat")){
|
||||
if (game.settings.get("foundryvtt-reve-de-dragon", "supprimer-dialogues-combat-chat")) {
|
||||
ChatUtility.removeMyChatMessageContaining(`<div data-passearme="${passeArme}">`);
|
||||
}
|
||||
}
|
||||
@ -296,7 +301,7 @@ export class RdDCombat {
|
||||
competence: competence,
|
||||
surprise: this.attacker.getSurprise(),
|
||||
surpriseDefenseur: this.defender.getSurprise(),
|
||||
essais: { }
|
||||
essais: {}
|
||||
};
|
||||
|
||||
if (this.attacker.isCreature()) {
|
||||
@ -359,7 +364,7 @@ export class RdDCombat {
|
||||
console.log("RdDCombat._sendMessageDefense", attackerRoll, essais, " / ", this.attacker, this.target, this.attackerId, attackerRoll.competence.data.categorie);
|
||||
|
||||
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
|
||||
mergeObject(attackerRoll.essais, essais, {overwrite: true});
|
||||
mergeObject(attackerRoll.essais, essais, { overwrite: true });
|
||||
const paramDemandeDefense = {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
essais: attackerRoll.essais,
|
||||
@ -417,9 +422,9 @@ export class RdDCombat {
|
||||
const arme = rollData.arme;
|
||||
const avecArme = arme?.data.categorie_parade != 'sans-armes';
|
||||
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
||||
ChatUtility.chatWithRollMode({
|
||||
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||
content: `<strong>Echec total à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
||||
}, this.defender.name)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -489,45 +494,45 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getDiviseurSignificative(rollData) {
|
||||
let facteurSign = (this.defender.isDemiSurprise() || rollData.needParadeSignificative) ? 2 : 1;
|
||||
if (RdDBonus.isDefenseAttaqueFinesse(rollData)) {
|
||||
_getDiviseurSignificative(defenderRoll) {
|
||||
let facteurSign = (this.defender.isDemiSurprise() || defenderRoll.needParadeSignificative) ? 2 : 1;
|
||||
if (RdDBonus.isDefenseAttaqueFinesse(defenderRoll)) {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
return facteurSign;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onParadeParticuliere(rollData) {
|
||||
console.log("RdDCombat._onParadeParticuliere >>>", rollData);
|
||||
if (!rollData.attackerRoll.isPart) {
|
||||
_onParadeParticuliere(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
||||
if (!defenderRoll.attackerRoll.isPart) {
|
||||
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
||||
ChatUtility.chatWithRollMode({
|
||||
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
||||
}, this.defender.name)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeNormale(rollData) {
|
||||
console.log("RdDCombat._onParadeNormale >>>", rollData);
|
||||
async _onParadeNormale(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeNormale >>>", defenderRoll);
|
||||
|
||||
this._consumeDefense(rollData.passeArme);
|
||||
await this.computeRecul(rollData);
|
||||
await this.computeDeteriorationArme(rollData);
|
||||
this._consumeDefense(defenderRoll.passeArme);
|
||||
await this.computeRecul(defenderRoll);
|
||||
await this.computeDeteriorationArme(defenderRoll);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeEchec(rollData) {
|
||||
console.log("RdDCombat._onParadeEchec >>>", rollData);
|
||||
async _onParadeEchec(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeEchec >>>", defenderRoll);
|
||||
|
||||
await RdDResolutionTable.displayRollData(rollData, this.defender, 'chat-resultat-parade.html');
|
||||
await RdDResolutionTable.displayRollData(defenderRoll, this.defender, 'chat-resultat-parade.html');
|
||||
|
||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
||||
this._sendMessageDefense(rollData.attackerRoll, { defense: true });
|
||||
this._storeDefense(rollData);
|
||||
this.removeChatMessageActionsPasseArme(defenderRoll.passeArme);
|
||||
this._sendMessageDefense(defenderRoll.attackerRoll, { defense: true });
|
||||
this._storeDefense(defenderRoll);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -579,10 +584,9 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
_onEsquiveParticuliere(rollData) {
|
||||
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
||||
let chatOptions = {
|
||||
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||
content: "<strong>Vous pouvez esquiver une deuxième esquive!</strong>"
|
||||
}
|
||||
ChatUtility.chatWithRollMode(chatOptions, this.defender.name)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -651,11 +655,11 @@ export class RdDCombat {
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async computeRecul(rollData) { // Calcul du recul (p. 132)
|
||||
const attaque = rollData.attackerRoll;
|
||||
if (this._isAttaqueCauseRecul(attaque)) {
|
||||
async computeRecul(defenderRoll) { // Calcul du recul (p. 132)
|
||||
const attackerRoll = defenderRoll.attackerRoll;
|
||||
if (this._isAttaqueCauseRecul(attackerRoll)) {
|
||||
|
||||
let impactRecul = this._computeImpactRecul(attaque);
|
||||
let impactRecul = this._computeImpactRecul(attackerRoll);
|
||||
const agilite = this.defender.isEntiteCauchemar()
|
||||
? this.defender.data.data.carac.reve.value
|
||||
: this.defender.data.data.carac.agilite.value;
|
||||
@ -663,13 +667,13 @@ export class RdDCombat {
|
||||
let rollRecul = await RdDResolutionTable.rollData({ caracValue: 10, finalLevel: impactRecul, showDice: false });
|
||||
|
||||
if (rollRecul.isSuccess) {
|
||||
rollData.show.recul = 'encaisse';
|
||||
defenderRoll.show.recul = 'encaisse';
|
||||
} else if (rollRecul.isETotal) {
|
||||
rollData.show.recul = 'chute';
|
||||
defenderRoll.show.recul = 'chute';
|
||||
}
|
||||
else {
|
||||
let chute = await RdDResolutionTable.rollData({ caracValue: agilite, finalLevel: impactRecul, showDice: false });
|
||||
rollData.show.recul = (chute.isSuccess)
|
||||
defenderRoll.show.recul = (chute.isSuccess)
|
||||
? 'recul'
|
||||
: 'chute';
|
||||
}
|
||||
@ -696,7 +700,13 @@ export class RdDCombat {
|
||||
console.log("RdDCombat.encaisser >>>", attackerRoll, defenderTokenId);
|
||||
|
||||
let defenderRoll = this._consumeDefense(attackerRoll.passeArme);
|
||||
if (defenderRoll && RdDCombat.isEchecTotal(defenderRoll)) {
|
||||
if (!defenderRoll) {
|
||||
defenderRoll = {
|
||||
attackerRoll: attackerRoll,
|
||||
show: {}
|
||||
};
|
||||
}
|
||||
else if (RdDCombat.isEchecTotal(defenderRoll)) {
|
||||
// TODO: echec total!!!
|
||||
this._onEchecTotal(defenderRoll);
|
||||
}
|
||||
@ -746,7 +756,6 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayActorCombatStatus(actor) {
|
||||
let rollMode = game.settings.get("core", "rollMode");
|
||||
let rollData = {
|
||||
alias: actor.name,
|
||||
etatGeneral: actor.getEtatGeneral(),
|
||||
@ -762,8 +771,9 @@ export class RdDCombat {
|
||||
} else if (actor.countBlessuresByName("graves") > 0) {
|
||||
rollData.isGrave = true;
|
||||
}
|
||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData);
|
||||
ChatUtility.createChatMessage({ content: content }, rollMode, actor.name);
|
||||
ChatUtility.createChatWithRollMode(actor.name, {
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -69,7 +69,7 @@ export class RdDCommands {
|
||||
return;
|
||||
}
|
||||
const term = path[0];
|
||||
fullPath = fullPath+term+' '
|
||||
fullPath = fullPath + term + ' '
|
||||
if (path.length == 1) {
|
||||
command.descr = `<strong>${fullPath}</strong>: ${command.descr}`;
|
||||
targetTable[term] = command;
|
||||
@ -192,15 +192,14 @@ export class RdDCommands {
|
||||
};
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
msg.content = await RdDResolutionTable.buildRollDataHtml(rollData);
|
||||
ChatUtility.chatWithRollMode(msg, game.user.name);
|
||||
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||
}
|
||||
|
||||
async rollDeDraconique(msg) {
|
||||
let rollMode = game.settings.get("core", "rollMode");
|
||||
let ddr = new DeDraconique().evaluate();
|
||||
await RdDDice.show(ddr, rollMode);
|
||||
msg.content = `Lancer d'un Dé draconique: ${ddr.total}`;
|
||||
ChatUtility.createChatMessage(msg, rollMode, game.user.name);
|
||||
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ export class RdDDice {
|
||||
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
||||
let whisper = null;
|
||||
let blind = false;
|
||||
rollMode = rollMode || game.settings.get("core", "rollMode");
|
||||
rollMode = rollMode ?? game.settings.get("core", "rollMode");
|
||||
switch (rollMode) {
|
||||
case "blindroll": //GM only
|
||||
blind = true;
|
||||
|
@ -91,9 +91,9 @@ export class RdDResolutionTable {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||
ChatUtility.chatWithRollMode(
|
||||
{ content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template) },
|
||||
actor?.userName ?? game.user.name)
|
||||
ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -139,7 +139,7 @@ export class RdDResolutionTable {
|
||||
}
|
||||
}
|
||||
static forceSignificative(chances) {
|
||||
chances.roll = Math.floor(chances.score /2);
|
||||
chances.roll = Math.floor(chances.score / 2);
|
||||
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
|
||||
}
|
||||
|
||||
|
@ -98,25 +98,25 @@ const nomEthylisme = ["Emeché", "Gris", "Pinté", "Pas frais", "Ivre", "Bu", "C
|
||||
/* -------------------------------------------- */
|
||||
const definitionsEncaissement = {
|
||||
"mortel": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "2", legeres: 0, graves: 1, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", legeres: 0, graves: 0, critiques: 1 },
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "2", eraflures: 0, legeres: 0, graves: 1, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "4 + @over20", eraflures: 0, legeres: 0, graves: 0, critiques: 1 },
|
||||
],
|
||||
"non-mortel": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "1", legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "100", vie: "0", eraflures: 0, legeres: 1, graves: 0, critiques: 0 },
|
||||
],
|
||||
"cauchemar": [
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: undefined, maximum: 0, endurance: "0", vie: "0", eraflures: 0, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 1, maximum: 10, endurance: "1d4", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 11, maximum: 15, endurance: "1d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 16, maximum: 19, endurance: "2d6", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
{ minimum: 20, maximum: undefined, endurance: "3d6 + @over20", vie: "0", eraflures: 1, legeres: 0, graves: 0, critiques: 0 },
|
||||
]
|
||||
};
|
||||
|
||||
@ -193,6 +193,7 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-appelchance.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-attaque.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-encaissement.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-parade.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-esquive.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/chat-resultat-competence.html',
|
||||
@ -260,14 +261,14 @@ export class RdDUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async processItemDropEvent( actorSheet, event) {
|
||||
static async processItemDropEvent(actorSheet, event) {
|
||||
let dragData = JSON.parse(event.dataTransfer.getData("text/plain"));
|
||||
console.log(dragData, actorSheet.actor._id);
|
||||
let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop
|
||||
let objetId = dragData.id || dragData.data._id;
|
||||
if ( dropID ) { // Dropped over an item !!!
|
||||
if ( actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if ( actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID) ) {
|
||||
if (actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if (actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID)) {
|
||||
await actorSheet.actor.enleverDeConteneur(objetId, actorSheet.objetVersConteneur[objetId]);
|
||||
await actorSheet.actor.ajouterAConteneur(objetId, dropID);
|
||||
}
|
||||
@ -283,7 +284,7 @@ export class RdDUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildArbreDeConteneur( actorSheet, data ) {
|
||||
static buildArbreDeConteneur(actorSheet, data) {
|
||||
actorSheet.objetVersConteneur = {}; // Table de hash locale pour recupération rapide du conteneur parent (si existant)
|
||||
// Attribution des objets aux conteneurs
|
||||
for (let conteneur of data.data.conteneurs) {
|
||||
@ -551,10 +552,10 @@ export class RdDUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _evaluatePerte(formula, over20) {
|
||||
console.log("_evaluatePerte", formula, over20)
|
||||
let perte = new Roll(formula, { over20: over20 })
|
||||
perte.evaluate()
|
||||
return perte.total
|
||||
console.log("_evaluatePerte", formula, over20);
|
||||
let perte = new Roll(formula, { over20: over20 });
|
||||
perte.evaluate();
|
||||
return perte.total;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -2,7 +2,7 @@
|
||||
{{#if (eq surprise 'totale')}}
|
||||
<span><strong>{{defender.name}}</strong> est totalement surpris</span>
|
||||
{{else if essais.defense}}
|
||||
<span><strong>{{defender.name}}</strong> doit</span>
|
||||
<span><strong>{{defender.name}}</strong> doit :</span>
|
||||
{{else}}
|
||||
<span><strong>{{defender.name}}</strong> doit se défendre
|
||||
{{#if (eq surprise 'demi')}} avec une significative {{/if}} :
|
||||
@ -12,7 +12,6 @@
|
||||
<br>
|
||||
{{#unless (eq surprise 'totale')}}
|
||||
{{#if essais.defense}}
|
||||
<br>
|
||||
{{#unless essais.defenseChance}}
|
||||
{{#if (eq defender.data.type 'personnage')}}
|
||||
<a class='chat-card-button' id='appel-chance-defense' data-attackerId='{{attackerId}}'
|
||||
@ -20,15 +19,15 @@
|
||||
</a>
|
||||
<br>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{#if (eq defender.data.type 'personnage')}}
|
||||
{{#if (eq defender.data.type 'personnage')}}
|
||||
{{#if (gt defender.data.data.compteurs.destinee.value 0)}}
|
||||
<a class='chat-card-button' id='appel-destinee-defense' data-attackerId='{{attackerId}}'
|
||||
data-defenderTokenId='{{defenderTokenId}}'>Utiliser la destinée</a>
|
||||
</a>
|
||||
<br>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
{{#each armes as |arme key|}}
|
||||
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'>
|
||||
|
42
templates/chat-resultat-encaissement.html
Normal file
42
templates/chat-resultat-encaissement.html
Normal file
@ -0,0 +1,42 @@
|
||||
{{#if isGM}}
|
||||
<span>
|
||||
{{#if (gt endurance 0)}}
|
||||
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
||||
{{#if (ne vie 0)}}et <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||
{{/if}}
|
||||
</span>
|
||||
{{else}}
|
||||
<h4>{{alias}} encaisse à
|
||||
<span>
|
||||
{{numberFormat dmg.total decimals=0 sign=true}}
|
||||
{{#if (eq dmg.mortalite 'non-mortel')~}}(coups non mortels)
|
||||
{{~else if (eq dmg.mortalite 'cauchemar')}}(entité de cauchemar)
|
||||
{{~/if}}
|
||||
</span>
|
||||
</h4>
|
||||
<div>
|
||||
Je d'encaissement de {{roll.total}}
|
||||
{{#unless (eq armure 0)}}, l'armure a protègé de {{armure}} {{#unless (eq penetration 0)}}(pénétration de {{penetration}})
|
||||
{{/unless}}
|
||||
{{/unless}}, total: <span class="rdd-roll-echec">{{total}}</span>
|
||||
<br>
|
||||
{{alias}} subit
|
||||
{{#if (gt eraflures 0)}}une contusion
|
||||
{{else if (gt legeres 0)}}une blessure légère
|
||||
{{else if (gt graves 0)}}une blessure grave
|
||||
{{else if (gt critique 0)}}une blessure critique
|
||||
{{else}}Rien du tout
|
||||
{{/if}}
|
||||
|
||||
({{dmg.loc.label}})
|
||||
{{#if (gt endurance 0)}}
|
||||
{{#if hasPlayerOwner}}, a perdu {{endurance}} points d'endurance
|
||||
{{#if (ne vie 0)}}, <span class="rdd-roll-echec">{{vie}} points de vie</span>{{/if}}
|
||||
{{/if}}
|
||||
{{#if (gt endurance 1)}}
|
||||
et {{#if sonne}}est <strong>sonné</strong><img class="chat-icon" src="icons/svg/stoned.svg" alt="charge" height="16" width="16" /> jusqu'à la fin du prochain round{{else}}n'est pas sonné{{/if}}
|
||||
({{jetEndurance}} / {{resteEndurance}})!
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
Loading…
Reference in New Issue
Block a user