diff --git a/module/actor.js b/module/actor.js index 802d1a80..0ed3bca2 100644 --- a/module/actor.js +++ b/module/actor.js @@ -208,9 +208,9 @@ export class RdDActor extends Actor { defenseMsg = RdDUtility.buildDefenseChatCard(this, target, rollData); explications += "
Cible : " + target.actor.data.name; } - explications += "
Dommages : " + rollData.degats + "
Localisation : " + rollData.loc.label; + explications += "
Dégâts : " + rollData.degats + "
Localisation : " + rollData.loc.label; } else { - explications = "
Echec ! Pas de dommages"; + explications = "
Echec ! Pas de dégâts"; } } } diff --git a/module/rdd-tmr-dialog.js b/module/rdd-tmr-dialog.js index 18edc327..e3ee7e84 100644 --- a/module/rdd-tmr-dialog.js +++ b/module/rdd-tmr-dialog.js @@ -7,6 +7,7 @@ import { TMRUtility } from "./tmr-utility.js"; import { RdDRollTables } from "./rdd-rolltables.js"; import { RdDResolutionTable } from "./rdd-resolution-table.js"; +/* -------------------------------------------- */ const tmrConstants = { col1_y: 30, col2_y: 55, @@ -16,6 +17,7 @@ const tmrConstants = { gridy: 28 } +/* -------------------------------------------- */ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ @@ -131,9 +133,14 @@ export class RdDTMRDialog extends Dialog { /* -------------------------------------------- */ _tellToUser(message) { - ChatMessage.create({ title: "TMR", content: message, user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") }); + ChatMessage.create({ title: "TMR", content: message, user: game.user._id }); } + /* -------------------------------------------- */ + _tellToGM(message) { + ChatMessage.create({ title: "TMR", content: message, user: game.user._id, whisper: ChatMessage.getWhisperRecipients("GM") }); + } + /* -------------------------------------------- */ async manageRencontre(coordTMR, cellDescr) { if (this.viewOnly) { @@ -360,6 +367,7 @@ export class RdDTMRDialog extends Dialog { this._addDemiReve(); this.displayPreviousRencontres(); this.displaySortReserve(); + }); if (this.viewOnly) { @@ -464,5 +472,6 @@ export class RdDTMRDialog extends Dialog { this._setTokenPosition(token); this.pixiApp.stage.addChild(token.sprite); } + } diff --git a/module/rdd-utility.js b/module/rdd-utility.js index cbd21a60..30fdca98 100644 --- a/module/rdd-utility.js +++ b/module/rdd-utility.js @@ -439,8 +439,8 @@ export class RdDUtility { else if ( result <= 12 ) txt = "Poitrine, dos"; else if ( result <= 14 ) txt = "Avant-bras, main, coude"; else if ( result <= 18 ) txt = "Epaule, bras, omoplate"; - else if ( result == 19) txt = "Tête autre"; - else if ( result == 20) txt = "Tête visage"; + else if ( result == 19) txt = "Tête"; + else if ( result == 20) txt = "Tête (visage)"; return { result: result, label: txt }; } diff --git a/module/tmr-utility.js b/module/tmr-utility.js index debd1498..5620bdb0 100644 --- a/module/tmr-utility.js +++ b/module/tmr-utility.js @@ -208,16 +208,16 @@ const TMRMapping = { } const rencontresTable = [ - {name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: true, + {name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: false, cite: "01-25", sanctuaire: "01-25", plaines: "01-20", pont: "01-20", collines: "01-15", foret: "01-15", monts: "01-10", desert: "01-10", fleuve: "01-05", lac: "01-05", marais: "01-02", gouffre: "01-02", necropole: "00-00", desolation: "00-00" } }, - {name:"Passeur des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: true, + {name:"Passeur des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: false, cite: "26-50", sanctuaire: "26-50", plaines: "21-40", pont: "21-40", collines: "16-30", foret: "16-30", monts: "11-20", desert: "11-20", fleuve: "06-10", lac: "06-10", marais: "03-04", gouffre: "03-04", necropole: "00-00", desolation: "00-00" } }, - {name:"Fleur des Rêves", data: { force: "1d6", ignorer: true, derober: true, refoulement: 1, quitterTMR: true, + {name:"Fleur des Rêves", data: { force: "1d6", ignorer: true, derober: true, refoulement: 1, quitterTMR: false, cite: "51-65", sanctuaire: "51-65", plaines: "41-55", pont: "41-55", collines: "31-42", foret: "31-42", monts: "21-26", desert: "21-26", fleuve: "11-13", lac: "11-13", marais: "05-05", gouffre: "05-05", necropole: "00-00", desolation: "00-00" } }, - {name:"Mangeur de Rêve", data: { force: "1d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: true, + {name:"Mangeur de Rêve", data: { force: "1d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: false, cite: "66-70", sanctuaire: "66-70", plaines: "56-60", pont: "56-60", collines: "43-54", foret: "43-54", monts: "27-44", desert: "27-44", fleuve: "14-37", lac: "14-37", marais: "06-29", gouffre: "06-29", necropole: "01-20", desolation: "01-20" } }, {name:"Changeur de Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: false, @@ -240,9 +240,23 @@ const rencontresTable = [ lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } } ] +/* -------------------------------------------- */ +const tmrConstants = { + col1_y: 30, + col2_y: 55, + cellw: 55, + cellh: 55, + gridx: 28, + gridy: 28 +} + /* -------------------------------------------- */ export class TMRUtility { + static getTMRConstants() { + return tmrConstants; + } + /* -------------------------------------------- */ static convertToTMRCoord( x, y ) { @@ -480,5 +494,43 @@ export class TMRUtility { let caseIndex = letter+num; console.log("Case ", letterValue, letter, num, TMRMapping[caseIndex].label ); } + + /* -------------------------------------------- */ + static _checkTMRCoord( x, y ) { + if (x >= 0 && x < 13 && y >= 0 && y < 15 ) return true; + return false; + } + + /* -------------------------------------------- */ + static computeRealPictureCoordinates( coordXY ) { + let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y; + return { + x: tmrConstants.gridx + (coordXY.x * tmrConstants.cellw), + y: tmrConstants.gridy + (coordXY.y * tmrConstants.cellh) + decallagePairImpair + } + } + + /* -------------------------------------------- */ + /** Returns a list of case inside a given distance + * + */ + static getTMRArea( coord, distance ) { + let pos = this.convertToCellCoord( coord ); + let posPic = this.computeRealPictureCoordinates( pos ); + let caseList = []; + for (let x=pos.x-distance; x<=pos.x+distance; x++ ) { // Loop thru lines + for (let y=pos.y-distance; y<=pos.y+distance; y++ ) { // Loop thru lines + //console.log("Parsing position", x, y); + if ( this._checkTMRCoord(x, y) ) { // Coordinate is valie + let posPicNow = this.computeRealPictureCoordinates( {x: x, y: y} ); + let dist = Math.sqrt(Math.pow(posPicNow.x - posPic.x,2) + Math.pow(posPicNow.y - posPic.y, 2)) / tmrConstants.cellw; + if ( dist < distance+0.5) { + caseList.push( this.convertToTMRCoord(x, y) ); // Inside the area + } + } + } + } + return caseList; + } } diff --git a/system.json b/system.json index 96157614..b76de95f 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "0.9.62", + "version": "0.9.63", "minimumCoreVersion": "0.7.5", "compatibleCoreVersion": "0.7.6", "templateVersion": 47,