Petites améliorations TMR #232

Merged
vincent.vandeme merged 1 commits from working into master 2020-11-14 20:17:16 +01:00
7 changed files with 444 additions and 348 deletions

View File

@ -7,6 +7,8 @@ import { RdDUtility } from "./rdd-utility.js";
import { TMRUtility } from "./tmr-utility.js"; import { TMRUtility } from "./tmr-utility.js";
import { RdDRollDialog } from "./rdd-roll-dialog.js"; import { RdDRollDialog } from "./rdd-roll-dialog.js";
import { RdDTMRDialog } from "./rdd-tmr-dialog.js"; import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
import { Misc } from "./misc.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
export class RdDActor extends Actor { export class RdDActor extends Actor {
@ -146,91 +148,45 @@ export class RdDActor extends Actor {
console.log(">>> ROLL", rollData, rolled); console.log(">>> ROLL", rollData, rolled);
let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel); let xpmsg = RdDResolutionTable.buildXpMessage(rolled, rollData.finalLevel);
let specialStr = "<br>Points de taches : " + rolled.tache + ", Points de qualité: " + rolled.qualite; let resumeCompetence = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
let explications = "<br>Points de taches : " + rolled.tache + ", Points de qualité: " + rolled.qualite;
// Fight management ! // Fight management !
let defenseMsg; let defenseMsg;
let encaisser = false; let encaisser = false;
if (rollData.arme || (rollData.competence && rollData.competence.name.toLowerCase() == 'esquive') ) { if (rollData.arme || (rollData.competence && rollData.competence.name.toLowerCase() == 'esquive') ) {
explications = ""
// In case of fight, replace the message per dommages + localization. it indicates if result is OK or not // In case of fight, replace the message per dommages + localization. it indicates if result is OK or not
if (rollData.attackerRoll) { // Defense case ! if (rollData.attackerRoll) { // Defense case !
if (rolled.isSuccess) { if (rolled.isSuccess) {
specialStr = "<br><strong>Attaque parée/esquivée !</strong>"; explications += "<br><strong>Attaque parée/esquivée !</strong>";
} else { } else {
specialStr = "<br><strong>Esquive/Parade échouée, encaissement !</strong>"; explications += "<br><strong>Esquive/Parade échouée, encaissement !</strong>";
encaisser = true; encaisser = true;
} }
} else { // This is the attack roll! } else { // This is the attack roll!
if (rolled.isSuccess) { if (rolled.isSuccess) {
if (rolled.tache >= 3) { // Critique ! if (rolled.isPart) { // Particulière !
console.log("TODO Gérer critique!"); console.log("TODO Gérer critique!");
} }
rollData.domArmePlusDom = parseInt(rollData.arme.data.dommages); rollData.domArmePlusDom = this._calculBonusDommages(rollData.selectedCarac, rollData.arme);
if (rollData.selectedCarac.label == "Mêlée") // +dom only for Melee rollData.degats = new Roll("2d10").roll().total + rollData.domArmePlusDom;
rollData.domArmePlusDom += parseInt(this.data.data.attributs.plusdom.value);
if (rollData.selectedCarac.label == "Lancer") { // +dom only for Melee/Lancer
let bdom = parseInt(this.data.data.attributs.plusdom.value);
if (bdom > parseInt(rollData.arme.data.dommages))
bdom = parseInt(rollData.arme.data.dommages);
rollData.domArmePlusDom += bdom
}
let encaissement = new Roll("2d10 + @domArmePlusDom", {domArmePlusDom : rollData.domArmePlusDom});
rollData.degats = parseInt(encaissement.roll().total);
rollData.loc = RdDUtility.getLocalisation(); rollData.loc = RdDUtility.getLocalisation();
for (let target of game.user.targets) { for (let target of game.user.targets) {
defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData); defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData);
specialStr = "<br><strong>Cible</strong> : " + target.actor.data.name; explications += "<br><strong>Cible</strong> : " + target.actor.data.name;
} }
specialStr += "<br>Dommages : " + rollData.degats + "<br>Localisation : " + rollData.loc.label; explications += "<br>Dommages : " + rollData.degats + "<br>Localisation : " + rollData.loc.label;
} else { } else {
specialStr = "<br>Echec ! Pas de dommages"; explications = "<br>Echec ! Pas de dommages";
} }
} }
} }
// Sort management // Sort management
let lvl = ""
if (rollData.selectedSort) { // Lancement de sort ! if (rollData.selectedSort) { // Lancement de sort !
let draconic = rollData.selectedSort.data.draconic; resumeCompetence = rollData.selectedDraconic.name + "/" + sort.name;
let costReve = rollData.selectedSort.data.ptreve_reel || rollData.selectedSort.data.ptreve; // cas de sort à ptreve variables explications = await this._rollLancementDeSort(rollData, rolled);
specialStr = "<br>Lancement du sort <strong>" + rollData.selectedSort.name + "</strong> : " + draconic.charAt(0).toUpperCase() + draconic.slice(1) + "/" + rollData.selectedSort.data.difficulte +
"/" + rollData.selectedSort.data.caseTMR + "/R" + costReve;
specialStr += "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
lvl = rollData.selectedDraconic.name + "/" + rollData.selectedSort.name;
let myReve = duplicate(this.data.data.reve.reve);
if (rolled.isSuccess) { // Réussite du sort !
if (rolled.tache >= 3) costReve = Math.ceil(costReve / 2);
if (costReve < 1) costReve = 1;
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
if (myReve.value < 0) myReve.value = 0;
await this.update({ "data.reve.reve": myReve });
specialStr += "<br>Réussite du sort pour " + costReve + " Points de Rêve";
if (!rollData.isSortReserve) {
this.currentTMR.close(); // Close TMR !
} else { // Mise en réserve
let reserve = duplicate(this.data.data.reve.reserve);
reserve.list.push({ coord: rollData.coord, sort: duplicate(rollData.selectedSort), draconic: duplicate(rollData.selectedDraconic) });
await this.update({ "data.reve.reserve": reserve });
this.currentTMR.updateSortReserve();
}
} else {
if (rolled.tache == -4) { // Echec total !
costReve *= 2;
myReve.value = myReve.value - costReve; // Todo 0 pts de reve !!!!
if (myReve.value < 0) myReve.value = 0;
await this.update({ "data.reve.reve": myReve });
specialStr += "<br><strong>Echec TOTAL</strong> du sort : " + costReve + " Points de Rêve";
} else {
specialStr += "<br>Echec du sort !";
}
this.currentTMR.close(); // Close TMR !
}
if (myReve.value == 0) { // 0 points de reve
ChatMessage.create({ title: "Zero Points de Reve !", content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
this.currentTMR.close(); // Close TMR !
}
} else {
lvl = (rollData.competence) ? rollData.competence.name : rollData.bmValue;
} }
// Save it for fight in the flags area // Save it for fight in the flags area
@ -238,9 +194,10 @@ export class RdDActor extends Actor {
// Final chat message // Final chat message
let chatOptions = { let chatOptions = {
content: "<strong>Test : " + rollData.selectedCarac.label + " / " + lvl + "</strong><br>Jet : " + content: "<strong>Test : " + rollData.selectedCarac.label + " / " + resumeCompetence + "</strong>"
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rolled.score + "%<br><strong>Résutat : </strong>" + result + "<br>" + + "<br>Jet : " + rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " -> " + rolled.score + "%<br><strong>Résutat : </strong>" + rolled.roll
"<strong>" + quality + "</strong>" + specialStr + xpmsg, + "<br><strong>" + quality + "</strong>"
+ explications + xpmsg,
user: game.user._id, user: game.user._id,
title: "Résultat du test" title: "Résultat du test"
} }
@ -266,6 +223,81 @@ export class RdDActor extends Actor {
} }
} }
_calculBonusDommages(carac, arme) {
const dmgArme = parseInt(arme.data.dommages);
const dmgPerso = parseInt(this.data.data.attributs.plusdom.value);
if (carac.label == "Tir") {
return dmgArme;
}
if (carac.label == "Lancer") {
return dmgArme + Math.min(dmgArme, dmgPerso);
}
return dmgArme + dmgPerso;
}
async _rollLancementDeSort(rollData, rolled) {
let sort = duplicate(rollData.selectedSort);
let closeTMR = true;
let coutReve = sort.data.ptreve_reel || sort.data.ptreve; // cas de sort à ptreve variables
let explications = "<br>Lancement du sort <strong>" + sort.name + "</strong> : " + Misc._upperFirst(sort.data.draconic)
+ " pour "+coutReve+ " points de Rêve"
+ "<br>Depuis la case " + rollData.coord + " (" + TMRUtility.getTMRDescription(rollData.coord).label + ")";
let myReve = duplicate(this.data.data.reve.reve);
if (rolled.isSuccess) { // Réussite du sort !
sort.ptreve_reel = coutReve;
if (rolled.isPart) {
coutReve = Math.max(Math.ceil(coutReve / 2), 1);
}
if (myReve.value > coutReve){
explications += "<br>Réussite du sort: " + coutReve + " points de Rêve sont dépensés";
if (rollData.isSortReserve) {
// Mise en réserve
myReve.value--;
await this.sortMisEnReserve(rollData, sort);
closeTMR = false;
}
}
else {
// Todo 0 pts de reve !!!!
explications += "<br>Pas assez de rêve";
mergeObject(rollData, RdDResolutionTable.getResultat("echec"));
}
} else {
if (rolled.isETotal) { // Echec total !
coutReve *= 2;
myReve.value = myReve.value - coutReve;
explications += "<br><strong>Echec TOTAL</strong> du sort : " + coutReve + " Points de Rêve";
} else {
coutReve = 0
explications += "<br>Echec du sort !";
}
}
myReve.value = Math.max(myReve.value - coutReve, 0);
await this.update({ "data.reve.reve": myReve });
if (myReve.value == 0) { // 0 points de reve
ChatMessage.create({ title: "Zero Points de Reve !", content: this.name + " est réduit à 0 Points de Rêve, et tombe endormi !" });
closeTMR = true;
}
if (closeTMR) {
this.currentTMR.close(); // Close TMR !
}
return explications
}
async sortMisEnReserve(rollData, sort) {
let reserve = duplicate(this.data.data.reve.reserve);
reserve.list.push({ coord: rollData.coord, sort: sort, draconic: duplicate(rollData.selectedDraconic) });
await this.update({ "data.reve.reserve": reserve });
this.currentTMR.updateSortReserve();
}
/* -------------------------------------------- */ /* -------------------------------------------- */
updateCarac( caracName, caracValue ) updateCarac( caracName, caracValue )
{ {
@ -404,13 +436,19 @@ export class RdDActor extends Actor {
let refoulement = duplicate(this.data.data.reve.refoulement); let refoulement = duplicate(this.data.data.reve.refoulement);
refoulement.value = refoulement.value + value; refoulement.value = refoulement.value + value;
let total = new Roll("d20").roll().total; let total = new Roll("d20").roll().total;
if ( total <= refoulement.value ) { if ( total <= refoulement.value ) {
ChatMessage.create( { title : "Souffle de Dragon",
content: game.user.name + " subit un Souffle de Dragon !" } );
refoulement.value = 0; refoulement.value = 0;
let souffle = RdDRollTables.getSouffle();
ChatMessage.create( { title : "Souffle de Dragon",
content: game.user.name + " subit un Souffle de Dragon : " + souffle.name } );
this.actor.createOwnedItem(souffle);
ret = "souffle"; ret = "souffle";
} }
await this.update( {"data.reve.refoulement": refoulement } ); await this.update( {"data.reve.refoulement": refoulement } );
return ret; return ret;
} }
@ -452,7 +490,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async updatePointsDeReve( value ) { async updatePointsDeReve( value ) {
let reve = duplicate(this.data.data.reve.reve); let reve = duplicate(this.data.data.reve.reve);
reve.value = reve.value + value; reve.value = Math.max(reve.value + value, 0);
await this.update( {"data.reve.reve": reve } ); await this.update( {"data.reve.reve": reve } );
} }
@ -633,9 +671,9 @@ export class RdDActor extends Actor {
let second = RdDResolutionTable.rollChances(target) let second = RdDResolutionTable.rollChances(target)
switch (second.qualite) { switch (second.qualite) {
case "part": case "sign": case "part": case "sign":
return { factor: 1.5, comment: "Double Particulière (150%) - " + result + " puis " + second } return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
default: default:
return { factor: 1, comment: "Particulière (100%) - " + result + " puis " + second } return { factor: 1, comment: "Particulière (100%) - " + result.roll + " puis " + second.roll }
} }
} }
@ -649,7 +687,7 @@ export class RdDActor extends Actor {
etat: this.data.data.compteurs.etat.value, etat: this.data.data.compteurs.etat.value,
draconicList: draconicList, draconicList: draconicList,
sortList: sortList, sortList: sortList,
selectedDraconic: draconicList[0], selectedDraconic: this.getBestDraconic(),
selectedSort: sortList[0], selectedSort: sortList[0],
coord: coord, coord: coord,
finalLevel: 0, finalLevel: 0,
@ -720,10 +758,10 @@ export class RdDActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCompetence( compName, armeItem=undefined, attackerRoll=undefined ) async rollCompetence( name, armeItem=undefined, attackerRoll=undefined )
{ {
let compItem = RdDUtility.findCompetence( this.data.items, compName); let competence = RdDUtility.findCompetence( this.data.items, name);
console.log("!!!!!!", compName, this.data.items, compItem); console.log("rollCompetence !!!", competence, armeItem, attackerRoll);
// Common rollData values // Common rollData values
let rollData = { let rollData = {
bonusmalusTable: CONFIG.RDD.bonusmalus, bonusmalusTable: CONFIG.RDD.bonusmalus,
@ -733,23 +771,23 @@ export class RdDActor extends Actor {
finalLevel: 0 finalLevel: 0
} }
if ( compItem.type == 'competencecreature') { // Specific case for Creatures if ( competence.type == 'competencecreature') { // Specific case for Creatures
if ( compItem.data.iscombat ) { if ( competence.data.iscombat ) {
armeItem = { name: compName, data: { dommages: compItem.data.dommages} }; armeItem = { name: name, data: { dommages: competence.data.dommages} };
} }
compItem.data.defaut_carac = "carac_creature"; // Fake default competence competence.data.defaut_carac = "carac_creature"; // Fake default competence
compItem.data.categorie = "creature"; // Fake default competence competence.data.categorie = "creature"; // Fake default competence
rollData.competence = compItem; rollData.competence = competence;
rollData.arme = armeItem; rollData.arme = armeItem;
rollData.carac = { carac_creature: { label: compName, value: compItem.data.carac_value } }; rollData.carac = { carac_creature: { label: name, value: competence.data.carac_value } };
} else { // Usual competence } else { // Usual competence
rollData.competence = compItem; rollData.competence = competence;
rollData.arme = armeItem; rollData.arme = armeItem;
rollData.carac = this.data.data.carac; rollData.carac = this.data.data.carac;
} }
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', rollData); let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-competence.html', rollData);
if (armeItem) { if (rollData.arme) {
new RdDRollDialog("arme", html, rollData, this ).render(true); new RdDRollDialog("arme", html, rollData, this ).render(true);
} else { } else {
new RdDRollDialog("competence", html, rollData, this ).render(true); new RdDRollDialog("competence", html, rollData, this ).render(true);
@ -762,7 +800,6 @@ export class RdDActor extends Actor {
let item = this.getOwnedItem(itemID); let item = this.getOwnedItem(itemID);
if ( item && item.data.data ) { if ( item && item.data.data ) {
let update = {_id: item._id, "data.equipe": !item.data.data.equipe }; let update = {_id: item._id, "data.equipe": !item.data.data.equipe };
//console.log(update);
await this.updateEmbeddedEntity("OwnedItem", update); await this.updateEmbeddedEntity("OwnedItem", update);
this.computeEncombrementTotal(); // Mise à jour encombrement this.computeEncombrementTotal(); // Mise à jour encombrement
} }
@ -845,4 +882,7 @@ export class RdDActor extends Actor {
return data; return data;
} }
} }

11
module/misc.js Normal file
View File

@ -0,0 +1,11 @@
/**
* This class is intended as a placeholder for utility methods unrelated
* to actual classes of the game system or of FoundryVTT
*/
export class Misc {
static _upperFirst(text) {
return text.charAt(0).toUpperCase() + text.slice(1);
}
}

View File

@ -65,9 +65,20 @@ export class RdDResolutionTable {
return table; return table;
} }
static getResultat(code)
{
let resultat = reussites.filter(r => code == r.code);
if (resultat == undefined)
{
resultat = reussites.find(r => r.code == "error");
}
return resultat;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static roll(carac, difficulte) { static roll(carac, difficulte) {
return this.rollChances(this.computeChances(carac, difficulte)); const chances = this.computeChances(carac, difficulte);
let rolled = this.rollChances(chances);
return rolled;
} }
static rollChances(chances) { static rollChances(chances) {

View File

@ -48,8 +48,8 @@ export class RdDRollDialog extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
performRollSort(html, isReserve = false) { performRollSort(html, isSortReserve = false) {
this.rollData.isSortReserve = isReserve; this.rollData.isSortReserve = isSortReserve;
this.actor.performRoll(this.rollData); this.actor.performRoll(this.rollData);
} }

View File

@ -12,7 +12,7 @@ export class RdDRollTables {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async getSouffle(toChat) { static async getSouffle(toChat = true) {
return RdDRollTables.genericGetTableResult("Souffles de Dragon", toChat); return RdDRollTables.genericGetTableResult("Souffles de Dragon", toChat);
} }

View File

@ -7,194 +7,162 @@ import { TMRUtility } from "./tmr-utility.js";
import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDRollTables } from "./rdd-rolltables.js";
import { RdDResolutionTable } from "./rdd-resolution-table.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js";
/** Helper functions */ const tmrConstants = {
col1_y: 30,
col2_y: 55,
cellw: 55,
cellh: 55,
gridx: 28,
gridy: 28
}
export class RdDTMRDialog extends Dialog { export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
constructor( html, actor, tmrData) { constructor(html, actor, tmrData) {
const dialogConf = {
// Common conf title: "Terres Médianes de Rêve",
let dialogConf = {
content: html, content: html,
buttons: buttons: {
{ closeButton: { label: "Fermer", callback: html => this.close(html) }
closeButton: },
{ default: "closeButton"
label: "Fermer", }
callback: html => this.close(html)
}
},
default: "closeButton"
}
let dialogOptions = { classes: [ "tmrdialog"] }
dialogConf.title = "Terres Médianes de Rêve",
dialogOptions.width = 920;
dialogOptions.height = 960;
dialogOptions['z-index'] = 20;
const dialogOptions = {
classes: ["tmrdialog"],
width: 920, height: 980,
'z-index': 20
}
super(dialogConf, dialogOptions); super(dialogConf, dialogOptions);
this.tmrdata = duplicate(tmrData); this.tmrdata = duplicate(tmrData);
this.col1_y = 30;
this.col2_y = 55;
this.cellh = 55;
this.cellw = 55;
this.actor = actor; this.actor = actor;
this.nbFatigue = 1; // 1 premier point de fatigue du à la montée this.nbFatigue = 1; // 1 premier point de fatigue du à la montée
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list); this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list); this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list);
this.allTokens = []
//console.log(this.rencontresExistantes); this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
this.pixiApp = new PIXI.Application( {width: 720, height: 860 } );
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
close() { close() {
this.actor.santeIncDec("fatigue", this.nbFatigue).then( super.close() ); // moving 1 cell costs 1 fatigue this.actor.santeIncDec("fatigue", this.nbFatigue).then(super.close()); // moving 1 cell costs 1 fatigue
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
displaySortReserve() { displaySortReserve() {
console.log(this.sortReserves); console.debug("displaySortReserve", this.sortReserves);
for (let sortReserve of this.sortReserves) { for (let sort of this.sortReserves) {
sortReserve.circle = new PIXI.Graphics(); this._trackToken(this._tokenSortEnReserve(sort));
sortReserve.circle.beginFill(0x767610, 0.6);
sortReserve.circle.drawCircle(0, 0, 6);
sortReserve.circle.endFill();
let coordXY = TMRUtility.convertToCellCoord( sortReserve.coord );
let basey = (coordXY.x % 2 == 0) ? this.col1_y : this.col2_y;
let myx = 28+(coordXY.x * this.cellw);
let myy = basey+28+(coordXY.y * this.cellh);
sortReserve.circle.x = myx - (this.cellw/2)+16;
sortReserve.circle.y = myy - (this.cellh/2)+16;
this.pixiApp.stage.addChild(sortReserve.circle);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
displayPreviousRencontres() { displayPreviousRencontres() {
console.debug("displayPreviousRencontres", this.rencontresExistantes);
for (let rencontre of this.rencontresExistantes) { for (let rencontre of this.rencontresExistantes) {
rencontre.circle = new PIXI.Graphics(); this._trackToken(this._tokenRencontre(rencontre));
rencontre.circle.beginFill(0x101010, 0.8);
rencontre.circle.drawCircle(0, 0, 6);
rencontre.circle.endFill();
let coordXY = TMRUtility.convertToCellCoord( rencontre.coord );
let basey = (coordXY.x % 2 == 0) ? this.col1_y : this.col2_y;
let myx = 28+(coordXY.x * this.cellw);
let myy = basey+28+(coordXY.y * this.cellh);
rencontre.circle.x = myx - (this.cellw/2)+16;
rencontre.circle.y = myy - (this.cellh/2)+16;
this.pixiApp.stage.addChild(rencontre.circle);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
updatePreviousRencontres() { updatePreviousRencontres() {
for (let rencontre of this.rencontresExistantes) { this._removeTokens(t => t.rencontre != undefined);
this.pixiApp.stage.removeChild( rencontre.circle );
}
this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list); this.rencontresExistantes = duplicate(this.actor.data.data.reve.rencontre.list);
this.displayPreviousRencontres(); this.displayPreviousRencontres();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
updateSortReserve() { updateSortReserve() {
for (let sortReserve of this.sortReserves) { //cleanup pixi icons this._removeTokens(t => t.sort != undefined);
this.pixiApp.stage.removeChild( sortReserve.circle ); this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list);
}
this.sortReserves = duplicate(this.actor.data.data.reve.reserve.list); // Then do it again!
this.displaySortReserve(); this.displaySortReserve();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async derober() { async derober() {
await this.actor.addTMRRencontre( this.currentRencontre ); await this.actor.addTMRRencontre(this.currentRencontre);
console.log("-> derober", this.currentRencontre); console.log("-> derober", this.currentRencontre);
ChatMessage.create( { title: "TMR", content: game.user.name + " s'est dérobé et quitte les TMR.", user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") } ); this._tellToGM(this.actor.name + " s'est dérobé et quitte les TMR.");
this.close(); this.close();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async refouler(data) { async refouler(data) {
ChatMessage.create( { title: "TMR", content: game.user.name + " a refoulé une rencontre.", user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") } ); this._tellToGM(this.actor.name + " a refoulé une rencontre.");
await this.actor.deleteTMRRencontreAtPosition( ); // Remove the stored rencontre if necessary await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
let result = await this.actor.ajouterRefoulement(1); let result = await this.actor.ajouterRefoulement(1);
this.updatePreviousRencontres(); this.updatePreviousRencontres();
if (result == "souffle") {
let souffle = RdDRollTables.getSouffle();
}
console.log("-> refouler", this.currentRencontre) console.log("-> refouler", this.currentRencontre)
this.updateValuesDisplay(); this.updateValuesDisplay();
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async matriser(data) { async maitriser(data) {
this.actor.deleteTMRRencontreAtPosition( ); // Remove the stored rencontre if necessary this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
this.updatePreviousRencontres(); this.updatePreviousRencontres();
const draconic = this.actor.getBestDraconic(); const draconic = this.actor.getBestDraconic();
const carac = this.actor.getCurrentReve(); const carac = this.actor.getCurrentReve();
// TODO: ajouter l'état général?
const etatGeneral = this.actor.data.data.compteurs.etat.value
const difficulte = draconic.data.niveau - this.currentRencontre.force; const difficulte = draconic.data.niveau - this.currentRencontre.force;
console.log("Maitriser", carac, draconic.data.niveau, this.currentRencontre.force); console.log("Maitriser", carac, draconic.data.niveau, this.currentRencontre.force);
const roll = RdDResolutionTable.roll(carac, difficulte); let rolled = RdDResolutionTable.roll(carac, difficulte);
let message = "<br><strong>Test : Rêve actuel / " + draconic.name + " / " + this.currentRencontre.name + "</strong>" + "<br>"
+ "<br>Jet : " + carac + " / " + difficulte + " -> " + rolled.score + "%<br><strong>Résutat : </strong>" + rolled.roll;
if (roll.isEchec) {
TMRUtility.processRencontreEchec( this.actor, this.currentRencontre); if (rolled.isEchec) {
ChatMessage.create( { title: "TMR", content: "Vous avez <strong>échoué</strong> à votre maîtrise d'un " . this.currentRencontre.name + " de force " + TMRUtility.processRencontreEchec(this.actor, this.currentRencontre);
this.currentRencontre.force + this._tellToUser("Vous avez <strong>échoué</strong> à maîtriser un " + this.currentRencontre.name + " de force " + this.currentRencontre.force
"<br>Vous quittez brutalement les Terres Médianes !", + "<br>Vous quittez brutalement les Terres Médianes !" + message);;
user: game.user._id, whisper: [ game.user ] } );
ChatMessage.create( { title: "TMR", content: game.user.name + " a perdu sa rencontre contre : " + this.currentRencontre.name + " de force " + this.currentRencontre.force, user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") } );
this.close(); this.close();
} else { } else {
TMRUtility.processRencontreReussite( this.actor, this.rencontre); TMRUtility.processRencontreReussite(this.actor, this.currentRencontre);
ChatMessage.create( { title: "TMR", content: "Vous avez <strong>réussi</strong> votre maîtrise d'un " + this.currentRencontre.name + " de force " + this.currentRencontre.force, user: game.user._id, whisper: [ game.user ] } ); this._tellToUser("Vous avez <strong>réussi</strong> à maîtriser un " + this.currentRencontre.name + " de force " + this.currentRencontre.force + message);
ChatMessage.create( { title: "TMR", content: game.user.name + " a gagné sa rencontre contre : " + this.currentRencontre.name + " de force " + this.currentRencontre.force, user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") } );
} }
console.log("-> matriser", this.currentRencontre); console.log("-> matriser", this.currentRencontre);
this.updateValuesDisplay(); this.updateValuesDisplay();
} }
/* -------------------------------------------- */ _tellToUser(message) {
async manageRencontre(coordTMR, cellDescr) ChatMessage.create({ title: "TMR", content: message, user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") });
{ }
// Roll until diffent than '8'
this.currentRencontre = undefined;
/* -------------------------------------------- */
async manageRencontre(coordTMR, cellDescr) {
this.currentRencontre = undefined;
let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR); let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR);
if (rencontre == undefined && new Roll("d7").roll().total == 7) { let deRencontre = new Roll("d7").roll();
rencontre = TMRUtility.rencontreTMRRoll(coordTMR, cellDescr); console.log("manageRencontre", deRencontre, rencontre);
if (rencontre == undefined) {
if (deRencontre.total == 7) {
rencontre = TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
}
} }
if (rencontre) { // Manages it if (rencontre) { // Manages it
console.log("manageRencontre", rencontre)
this.currentRencontre = duplicate(rencontre); this.currentRencontre = duplicate(rencontre);
let dialog = new Dialog( { title: "Rencontre en TMR!", let dialog = new Dialog({
content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "<br>", title: "Rencontre en TMR!",
buttons: { content: "Vous recontrez un " + rencontre.name + " de force " + rencontre.force + "<br>",
derober: { buttons: {
icon: '<i class="fas fa-check"></i>', derober: { icon: '<i class="fas fa-check"></i>', label: "Se dérober", callback: () => this.derober() },
label: "Se dérober", refouler: { icon: '<i class="fas fa-check"></i>', label: "Refouler", callback: () => this.refouler() },
callback: () => this.derober() maitiser: { icon: '<i class="fas fa-check"></i>', label: "Maîtriser", callback: () => this.maitriser() }
}, },
refouler: { default: "derober"
icon: '<i class="fas fa-check"></i>', });
label: "Refouler",
callback: () => this.refouler()
},
maitiser: {
icon: '<i class="fas fa-check"></i>',
label: "Maîtriser",
callback: () => this.matriser()
}
}
} );
dialog.render(true); dialog.render(true);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
performRoll (html) { performRoll(html) {
this.actor.performRoll( this.rollData ); this.actor.performRoll(this.rollData);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -203,7 +171,8 @@ export class RdDTMRDialog extends Dialog {
ptsreve.innerHTML = this.actor.data.data.reve.reve.value; ptsreve.innerHTML = this.actor.data.data.reve.reve.value;
let tmrpos = document.getElementById("tmr-pos"); let tmrpos = document.getElementById("tmr-pos");
let tmr = TMRUtility.getTMRDescription( this.actor.data.data.reve.tmrpos.coord ); let tmr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
console.log("updateValuesDisplay", this.actor.data.data.reve.tmrpos, tmr);
tmrpos.innerHTML = this.actor.data.data.reve.tmrpos.coord + " (" + tmr.label + ")"; tmrpos.innerHTML = this.actor.data.data.reve.tmrpos.coord + " (" + tmr.label + ")";
let etat = document.getElementById("etatgeneral-value"); let etat = document.getElementById("etatgeneral-value");
@ -213,12 +182,12 @@ export class RdDTMRDialog extends Dialog {
refoulement.innerHTML = this.actor.data.data.reve.refoulement.value; refoulement.innerHTML = this.actor.data.data.reve.refoulement.value;
let fatigueItem = document.getElementById("fatigue-table"); let fatigueItem = document.getElementById("fatigue-table");
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max ).html() + "</table>"; fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix(this.actor.data.data.sante.fatigue.value, this.actor.data.data.sante.endurance.max).html() + "</table>";
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
manageCaseHumideResult() { manageCaseHumideResult() {
if ( this.toclose ) if (this.toclose)
this.close(); this.close();
} }
@ -226,42 +195,41 @@ export class RdDTMRDialog extends Dialog {
async manageCaseHumide(cellDescr) { async manageCaseHumide(cellDescr) {
if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais") { if (cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais") {
let draconic = this.actor.getBestDraconic(); let draconic = this.actor.getBestDraconic();
let carac = this.actor.getCurrentReve(); let carac = this.actor.getCurrentReve();
let level = draconic.data.niveau - 7; // TODO: ajouter l'état général?
let rolled = RdDResolutionTable.roll(carac, level);//RdDResolutionTable.computeChances(carac, level); const etatGeneral = this.actor.data.data.compteurs.etat.value
let difficulte = draconic.data.niveau - 7;
let rolled = RdDResolutionTable.roll(carac, difficulte);
console.log("manageCaseHumide >>", rolled); console.log("manageCaseHumide >>", rolled);
let content = ""; let explication = "";
this.toclose = rolled.isEchec; this.toclose = rolled.isEchec;
if (rolled.isEchec) { if (rolled.isEchec) {
content += "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> !" explication += "Vous êtes entré sur une case humide, et vous avez <strong>raté</strong> votre maîtrise ! Vous <strong>quittez les Terres Médianes</strong> !"
} }
else { else {
content += "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise !" explication += "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise !"
} }
explication += "<br><strong>Test : Rêve actuel / " + draconic.name + " / " + cellDescr.type + "</strong>"
content += " " + draconic.name + ": " + carac + " / " + level + " -> " + rolled.roll + " / " + rolled.score; + "<br>Jet : " + carac + " / " + difficulte + " -> " + rolled.score + "%<br><strong>Résutat : </strong>" + rolled.roll;
if (rolled.isETotal) { if (rolled.isETotal) {
let souffle = RdDRollTables.getSouffle(true); let souffle = RdDRollTables.getSouffle();
content += "<br>Vous avez fait un Echec Total. Vous subissez un Souffle de Dragon : " + souffle.name; explication += "<br>Vous avez fait un Echec Total. Vous subissez un Souffle de Dragon : " + souffle.name;
this.actor.createOwnedItem(souffle); this.actor.createOwnedItem(souffle);
} }
if (rolled.isPart) { if (rolled.isPart) {
content += "<br>Vous avez fait une Réussite Particulière"; explication += "<br>Vous avez fait une Réussite Particulière";
content += RdDResolutionTable.buildXpMessage(rolled, level) explication += RdDResolutionTable.buildXpMessage(rolled, difficulte)
} }
let humideDiag = new Dialog({ let humideDiag = new Dialog({
title: "Case humide", title: "Case humide",
content: content, content: explication,
buttons: { buttons: {
choice: { choice: { icon: '<i class="fas fa-check"></i>', label: "Fermer", callback: () => this.manageCaseHumideResult() }
icon: '<i class="fas fa-check"></i>',
label: "Fermer",
callback: () => this.manageCaseHumideResult()
}
} }
} }
); );
@ -270,77 +238,60 @@ export class RdDTMRDialog extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
updateSprites( myself ) async declencheSortEnReserve(coordTMR) {
{ let sortReserve = this.sortReserves.find(it => it.coord == coordTMR)
let coordTMR = myself.actor.data.data.reve.tmrpos.coord; if (sortReserve != undefined) {
let coordXY = TMRUtility.convertToCellCoord( coordTMR ); await this.actor.deleteSortReserve(sortReserve.coord);
let basey = (coordXY.x % 2 == 0) ? myself.col1_y : myself.col2_y; this.updateSortReserve();
let myx = 28+(coordXY.x * myself.cellw); console.log("declencheSortEnReserve", sortReserve)
let myy = basey+28+(coordXY.y * myself.cellh); const declenchementSort = "Vous avez déclenché le sort <strong>" + sortReserve.sort.name
+ "</strong> en réserve en " + sortReserve.coord + " (" + TMRUtility.getTMRDescription(sortReserve.coord).label
myself.circle.x = myx; + ") avec " + sortReserve.sort.ptreve_reel + " points de Rêve";
myself.circle.y = myy; this._tellToUser(declenchementSort);
} this.close();
/* -------------------------------------------- */
async declencheSortEnReserve( coordTMR )
{
for (let sortReserve of this.sortReserves ) {
if ( sortReserve.coord == coordTMR) {
await this.actor.deleteSortReserve(coordTMR);
this.updateSortReserve();
ChatMessage.create( { title: "Sort en réserve", content: "Vous avez déclenché le sort en réserve " + sortReserve.sort.name, user: game.user._id } );
this.close();
}
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async getCursorPosition(event) { async deplacerDemiReve(event) {
let origEvent = event.data.originalEvent; let origEvent = event.data.originalEvent;
let myself = event.target.tmrObject; let myself = event.target.tmrObject;
//console.log("EVENT:", event); let eventCoord = RdDTMRDialog._computeEventCoord(origEvent);
let canvasRect = origEvent.target.getBoundingClientRect(); let cellx = eventCoord.cellx;
let x = origEvent.clientX - canvasRect.left; let celly = eventCoord.celly;
let y = origEvent.clientY - canvasRect.top; console.log("deplacerDemiReve >>>>", cellx, celly);
let cellx = Math.floor( x / myself.cellw);// [From 0 -> 12]
if (cellx % 2 == 0)
y -= myself.col1_y;
else
y -= myself.col2_y;
let celly = Math.floor( y / myself.cellh);// [From 0 -> 14]
console.log(">>>>", cellx, celly );
let currentPos = TMRUtility.convertToCellCoord(myself.actor.data.data.reve.tmrpos.coord); let currentPos = TMRUtility.convertToCellCoord(myself.actor.data.data.reve.tmrpos.coord);
if ( (Math.abs(cellx - currentPos.x) > 1 || Math.abs(celly - currentPos.y) > 1) ||
(currentPos.y == 0 && celly > currentPos.y && cellx != currentPos.x && currentPos.x % 2 == 0) || if (RdDTMRDialog._horsDePortee(currentPos, cellx, celly)) {
(celly == 0 && celly < currentPos.y && cellx != currentPos.x && currentPos.x % 2 == 1) ) { ui.notifications.error("Vous ne pouvez vous déplacer que sur des cases adjacentes à votre position");
ui.notifications.error( "Vous ne pouvez vous déplacer que sur des cases adjacentes à votre position, et pas en diagonale" );
} else { } else {
let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly); let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly);
let cellDescr = TMRUtility.getTMRDescription( coordTMR ); let cellDescr = TMRUtility.getTMRDescription(coordTMR);
console.log("TMR column is", coordTMR, cellx, celly, cellDescr, this);
console.log("deplacerDemiReve: TMR column is", coordTMR, cellx, celly, cellDescr, this);
let tmrPos = duplicate(myself.actor.data.data.reve.tmrpos); let tmrPos = duplicate(myself.actor.data.data.reve.tmrpos);
tmrPos.coord = coordTMR; tmrPos.coord = coordTMR;
await myself.actor.update( { "data.reve.tmrpos": tmrPos } ); await myself.actor.update({ "data.reve.tmrpos": tmrPos });
myself.updateSprites(myself); myself._updateDemiReve(myself);
myself.nbFatigue += 1; myself.nbFatigue += 1;
myself.updateValuesDisplay(); myself.updateValuesDisplay();
myself.manageRencontre(coordTMR, cellDescr); myself.manageRencontre(coordTMR, cellDescr);
myself.manageCaseHumide( cellDescr ); myself.manageCaseHumide(cellDescr);
await myself.declencheSortEnReserve( coordTMR ); await myself.declencheSortEnReserve(coordTMR);
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async activateListeners(html) { async activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
var row = document.getElementById("tmrrow1"); var row = document.getElementById("tmrrow1");
var cell1 = row.insertCell(1); var cell1 = row.insertCell(1);
cell1.append( this.pixiApp.view ); cell1.append(this.pixiApp.view);
// Roll Sort // Roll Sort
html.find('#lancer-sort').click((event) => { html.find('#lancer-sort').click((event) => {
@ -348,40 +299,122 @@ export class RdDTMRDialog extends Dialog {
}); });
// load the texture we need // load the texture we need
await this.pixiApp.loader.add('tmr', 'systems/foundryvtt-reve-de-dragon/styles/ui/tmp_main_r1.webp').load((loader, resources) => { await this.pixiApp.loader
// This creates a texture from a 'bunny.png' image .add('tmr', 'systems/foundryvtt-reve-de-dragon/styles/ui/tmp_main_r1.webp')
const mytmr = new PIXI.Sprite(resources.tmr.texture); .add('demi-reve', "icons/svg/sun.svg")
// Setup the position of the bunny .load((loader, resources) => {
mytmr.x = 0;
mytmr.y = 0;
mytmr.width = 720;
mytmr.height = 860;
// Rotate around the center
mytmr.anchor.x = 0;
mytmr.anchor.y = 0;
mytmr.interactive = true;
mytmr.buttonMode = true;
mytmr.tmrObject = this;
mytmr.on('pointerdown', this.getCursorPosition);
this.circle = new PIXI.Graphics(); // This creates a texture from a TMR image
this.circle.beginFill(0x9966FF, 0.6); const mytmr = new PIXI.Sprite(resources.tmr.texture);
this.circle.drawCircle(0, 0, 15); // Setup the position of the TMR
this.circle.endFill(); mytmr.x = 0;
this.updateSprites( this ); mytmr.y = 0;
mytmr.width = 720;
mytmr.height = 860;
// Rotate around the center
mytmr.anchor.x = 0;
mytmr.anchor.y = 0;
mytmr.interactive = true;
mytmr.buttonMode = true;
mytmr.tmrObject = this;
mytmr.on('pointerdown', this.deplacerDemiReve);
this.pixiApp.stage.addChild(mytmr);
// Add the bunny to the scene we are building this._addDemiReve();
this.pixiApp.stage.addChild(mytmr); this.displayPreviousRencontres();
this.pixiApp.stage.addChild(this.circle); this.displaySortReserve();
});
this.displayPreviousRencontres(); await this.actor.updatePointsDeReve((this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
this.displaySortReserve();
} );
await this.actor.updatePointsDeReve( (this.tmrdata.isRapide) ? -2 : -1); // 1 point defatigue
this.updateValuesDisplay(); this.updateValuesDisplay();
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord); let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
this.manageRencontre( this.actor.data.data.reve.tmrpos.coord,cellDescr ); this.manageRencontre(this.actor.data.data.reve.tmrpos.coord, cellDescr);
this.manageCaseHumide( cellDescr ); this.manageCaseHumide(cellDescr);
}
/* -------------------------------------------- */
static _computeEventCoord(origEvent) {
let canvasRect = origEvent.target.getBoundingClientRect();
let x = origEvent.clientX - canvasRect.left;
let y = origEvent.clientY - canvasRect.top;
let cellx = Math.floor(x / tmrConstants.cellw); // [From 0 -> 12]
y -= (cellx % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
let celly = Math.floor(y / tmrConstants.cellh); // [From 0 -> 14]
return { cellx, celly };
}
static _horsDePortee(pos, cellx, celly) {
return Math.abs(cellx - pos.x) > 1
|| Math.abs(celly - pos.y) > 1
|| (pos.y == 0 && celly > pos.y && cellx != pos.x && pos.x % 2 == 0)
|| (celly == 0 && celly < pos.y && cellx != pos.x && pos.x % 2 == 1);
}
_tokenRencontre(rencontre) {
let sprite = new PIXI.Graphics();
sprite.beginFill(0x767610, 0.6);
sprite.drawCircle(0, 0, 6);
sprite.endFill();
sprite.decallage = {
x: (tmrConstants.cellw / 2) - 16,
y: 16 - (tmrConstants.cellh / 2)
};
return { sprite: sprite, rencontre: rencontre, coordTMR: () => rencontre.coord };
}
_tokenSortEnReserve(sort) {
let sprite = new PIXI.Graphics();
sprite.beginFill(0x101010, 0.8);
sprite.drawCircle(0, 0, 6);
sprite.endFill();
sprite.decallage = {
x: 16 - (tmrConstants.cellw / 2),
y: 16 - (tmrConstants.cellh / 2)
}
return { sprite: sprite, sort: sort, coordTMR: () => sort.coord}
}
_tokenDemiReve() {
let texture = PIXI.utils.TextureCache['demi-reve'];
let sprite = new PIXI.Sprite(texture);
sprite.width = tmrConstants.cellw * 0.7;
sprite.height = tmrConstants.cellh * 0.7;
sprite.anchor.set(0.5);
sprite.tint = 0x00FFEE;
return { sprite: sprite, actor: this.actor, coordTMR: () => this.actor.data.data.reve.tmrpos.coord }
}
/* -------------------------------------------- */
_addDemiReve() {
this.demiReve = this._tokenDemiReve();
this._setTokenPosition(this.demiReve);
this.pixiApp.stage.addChild(this.demiReve.sprite);
}
_updateDemiReve(myself) {
myself._setTokenPosition(myself.demiReve);
}
_setTokenPosition(token) {
let coordXY = TMRUtility.convertToCellCoord(token.coordTMR());
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
let dx = (token.sprite.decallage == undefined) ? 0 : token.sprite.decallage.x;
let dy = (token.sprite.decallage == undefined) ? 0 : token.sprite.decallage.y;
token.sprite.x = tmrConstants.gridx + (coordXY.x * tmrConstants.cellw) + dx;
token.sprite.y = tmrConstants.gridy + (coordXY.y * tmrConstants.cellh) + dy + decallagePairImpair;
}
_removeTokens(filter) {
const tokensToRemove = this.allTokens.filter(filter);
for (let token of tokensToRemove) {
this.pixiApp.stage.removeChild(token.sprite);
}
}
_trackToken(token) {
this.allTokens.push(token)
this._setTokenPosition(token);
this.pixiApp.stage.addChild(token.sprite);
} }
} }

View File

@ -276,6 +276,7 @@ export class TMRUtility {
//console.log(val, scoreDef, min, max); //console.log(val, scoreDef, min, max);
if ( val >= min && val <= max) { if ( val >= min && val <= max) {
rencontre.force = new Roll(rencontre.data.force).roll().total; rencontre.force = new Roll(rencontre.data.force).roll().total;
rencontre.coord = coordTMR
return rencontre; return rencontre;
} }
} }
@ -288,9 +289,9 @@ export class TMRUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async processRencontreReussite( actor, rencontre ) { static async processRencontreReussite( actor, rencontre ) {
let msg = "Vous avez réussi votre maîtrise ! "; let msg = "Vous avez réussi votre maîtrise ! ";
console.log("processRencontreReussite", actor, rencontre);
if (rencontre.name == "Messagers des Rêves") { if (rencontre.name == "Messagers des Rêves") {
msg += "Le Messager des Rêves vous permet de lancer votre sort à XX cases !"; msg += "Le Messager des Rêves vous permet de lancer votre sort à XX cases !";