Divers fixes autour des sorts et icones

This commit is contained in:
2021-04-14 20:47:57 +02:00
parent 7b8503e632
commit 2d8bfe7b05
25 changed files with 364 additions and 122 deletions

View File

@ -135,24 +135,30 @@ export class VadentisActor extends Actor {
if (myRoll.results[0] > 1 && myRoll.total >= devotionSort.data.difficulty) {
msgData.img = 'systems/foundryvtt-vadentis/images/icons/tchat_sort_réussi.webp';
let effectClean = devotionSort.data.effect; //.replace( /(<([^>]+)>)/ig, '');
msgData.msg = `${this.name} a réussi son ${name} et perd ${devotionSort.data.pe} Points d'Energie (lancer : ${formulaFull}).<br>${effectClean}`;
msgData.msg = `${this.name} a réussi son ${name} et perd ${devotionSort.data.pe} Points d'Energie (lancer : ${formulaFull} => <strong>${myRoll.total} / ${devotionSort.data.difficulty}</strong>).`;
let maintain = (devotionSort.data.ismaintain)?"Oui":"Non";
let complex = (devotionSort.data.complexactions)?"Oui":"Non";
msgData.msg += `<br>Peut être maintenu: ${maintain}<br>Actions complexes : ${complex}`;
msgData.msg += `<br><strong>Description : </strong>${devotionSort.data.notes.replace(/<\/?[^>]+(>|$)/g, "")}`;
let newEnergie = this.data.data.stats.pointsenergie.value - devotionSort.data.pe;
await this.update( {'data.stats.pointsenergie.value': newEnergie });
if (myRoll.results[0] >= devotionSort.data.valuecritical ) { // Critique ?
msgData.img = 'systems/foundryvtt-vadentis/images/icons/tchat_réussite_critique.webp';
msgData.ms += "<br>C'est une <strong>réussite critique</strong> !";
msgData.msg += "<br>C'est une <strong>réussite critique</strong> !";
msgData.msg += `<br><strong>Effet critique : </strong>${devotionSort.data.criticaleffect.replace(/<\/?[^>]+(>|$)/g, "")}`;
} else {
msgData.msg += `<br><strong>Effet : </strong>${devotionSort.data.effect.replace(/<\/?[^>]+(>|$)/g, "")}`;
}
if ( devotionSort.data.damage != "") {
let formula = devotionSort.data.damage;
if (myRoll.results[0] == 20 ) { // Critique ?
if (myRoll.results[0] >= devotionSort.data.valuecritical ) { // Critique ?
msgData.msg += `<br>Et provoque les dégats critiques suivants : `;
formula = devotionSort.data.damagecritical;
} else {
msgData.msg += `<br>Et provoque les dégats suivants : `;
}
content += `${formula}`;
}
if ( newEnergie < 0) {
msgData.msg += `<br><strong>Attention</strong> : Les Points d'Energie de ${this.name} sont négatifs ! Il convient d'éditer ses Points de Vie en conséquence.`;
@ -166,6 +172,7 @@ export class VadentisActor extends Actor {
msgData.msg = `${this.name} a échoué son lancer de ${name}`;
}
}
console.log(devotionSort.data.description, msgData);
ChatMessage.create({
//whisper: ChatUtility.getWhisperRecipientsAndGMs(game.user.name),
content: await renderTemplate(`systems/foundryvtt-vadentis/templates/chat-generic-result.html`, msgData)
@ -318,7 +325,7 @@ export class VadentisActor extends Actor {
}
/* -------------------------------------------- */
async genericRoll( stat ) {
async genericRoll( stat, key ) {
let statValue = this._getCombatValue( stat );
let formulaFull = this.buildTexteFormula( stat );
@ -326,7 +333,7 @@ export class VadentisActor extends Actor {
let myRoll = await VadentisUtility.processRoll("1d20+"+statValue );
let msgData = {
alias: this.name,
img: "",
img: `systems/foundryvtt-vadentis/images/icons/feuille_perso_${key}.webp`,
title: VadentisUtility.buildJetText( stat),
msg: `${formulaFull} => <strong>${myRoll.total}</strong>`
}
@ -349,13 +356,13 @@ export class VadentisActor extends Actor {
/* -------------------------------------------- */
async rollCombat( combatName ) {
let stat = this.data.data.combat[combatName];
this.genericRoll( stat );
this.genericRoll( stat, combatName );
}
/* -------------------------------------------- */
rollMagie( magieName ) {
let stat = this.data.data.magie[magieName];
this.genericRoll( stat );
this.genericRoll( stat, magieName );
}
/* -------------------------------------------- */