Still improving spells

This commit is contained in:
LeRatierBretonnien 2020-07-17 22:04:35 +02:00
parent 500b620c25
commit b996682e09
10 changed files with 471 additions and 251 deletions

View File

@ -28,16 +28,16 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=5
FILE_NAME_0=6386;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
current_page=7
FILE_NAME_0=5905;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplate.json;0;2
FILE_NAME_1=6606;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor-sheet.js;0;2
FILE_NAME_2=5159;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-tmr-dialog.js;0;2
FILE_NAME_3=12962;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_4=516;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fsystem.json;0;2
FILE_NAME_5=20345;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_6=236;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-tmr.html;0;2
FILE_NAME_7=8769;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
FILE_NAME_8=0;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2
FILE_NAME_2=0;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-utility.js;0;2
FILE_NAME_3=516;JSON;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fsystem.json;0;2
FILE_NAME_4=20398;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Factor-sheet.html;0;2
FILE_NAME_5=4675;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-tmr-dialog.js;0;2
FILE_NAME_6=590;HTML;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Ftemplates%2Fdialog-tmr.html;0;2
FILE_NAME_7=10285;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Factor.js;0;2
FILE_NAME_8=135;Javascript;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fmodule%2Frdd-main.js;0;2
FILE_NAME_9=7463;CSS;0;EUTF-8;0;1;0;%2Fhome%2Fmorr%2Fwork%2Ffoundryvtt%2Ffoundryvtt-reve-de-dragon%2Fstyles%2Fsimple.css;0;2
[VTE]

View File

@ -255,6 +255,31 @@ export class RdDActor extends Actor {
data.compteurs.etat.value = state;
}
/* -------------------------------------------- */
async ajouterRefoulement( value=1) {
let ret = "none";
let refoulement = duplicate(this.data.data.reve.refoulement);
refoulement.value = refoulement.value + value;
let myroll = new Roll("d20");
myroll.roll();
if ( myroll.total <= refoulement.value ) {
ChatMessage.create( { title : "Souffle de Dragon",
content: game.user.name + " subit un Souffle de Dragon !" } );
refoulement.value = 0;
ret = "souffle";
}
await this.update( {"data.reve.refoulement": refoulement } );
return ret;
}
/* -------------------------------------------- */
async updatePointsDeReve( value ) {
let reve = duplicate(this.data.data.reve.reve);
reve.value = reve.value + value;
await this.update( {"data.reve.reve": reve } );
}
/* -------------------------------------------- */
testSiSonne( sante, endurance )
{
@ -379,14 +404,26 @@ export class RdDActor extends Actor {
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-carac.html', rollData);
new RdDRollDialog("carac", html, rollData, this ).render(true);
}
/* -------------------------------------------- */
getSortList( ) {
let sortList = []
for (const item of this.data.items) {
if (item.type == "sort" )
sortList.push(item);
}
return sortList;
}
/* -------------------------------------------- */
async rollSort( sortID )
{
console.log("Loading TMR template!!!");
let data = {
fatigueHTML:"<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( this.data.data.sante.fatigue.value, this.data.data.sante.endurance.max ).html() + "</table>"
}
fatigueHTML:"<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( this.data.data.sante.fatigue.value, this.data.data.sante.endurance.max ).html() + "</table>",
sort: this.getSortList(),
caracReve: this.data.data.carac.reve.value
}
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-tmr.html', data );
new RdDTMRDialog(sortID, html, this ).render(true);
}

View File

@ -3,6 +3,7 @@
* @extends {Dialog}
*/
import { RdDUtility } from "./rdd-utility.js";
import { TMRUtility } from "./tmr-utility.js";
export class RdDTMRDialog extends Dialog {
@ -23,7 +24,7 @@ export class RdDTMRDialog extends Dialog {
default: "rollButton"
}
let dialogOptions = { classes: [ "tmrdialog"] }
dialogConf.title = "Terres Médianes de Rêve",
dialogOptions.width = 920;
dialogOptions.height = 960;
@ -37,22 +38,45 @@ export class RdDTMRDialog extends Dialog {
this.actor = actor;
this.sort = sort;
this.pixiApp = new PIXI.Application( {width: 720, height: 860 } );
}
/* -------------------------------------------- */
async derober(data) {
async derober() {
await this.maximize();
console.log("-> derober", this.currentRencontre)
let rencontre = duplicate(this.actor.data.data.reve.rencontre);
rencontre.list.push( {coord: this.actor.data.data.reve.tmrpos.coord, rencontre: this.currentRencontre} );
console.log("-> derober", this.currentRencontre);
}
/* -------------------------------------------- */
async refouler(data) {
let result = await this.actor.ajouterRefoulement(1);
if (result == "souffle") {
let souffle = TMRUtility.getSouffle();
}
await this.maximize();
console.log("-> refouler", this.currentRencontre)
this.updateValuesDisplay();
}
/* -------------------------------------------- */
async matriser(data) {
await this.maximize();
console.log("-> matriser", this.currentRencontre)
let draconic = this.actor.getBestDraconic();
let carac = this.actor.getCurrentReve();
let level = draconic.data.niveau - this.currentRencontre.force;
let scoreDef = CONFIG.RDD.resolutionTable[carac][level+10];
let myroll = new Roll("d100");
myroll.roll();
if ( myroll.total > scoreDef.score ) {
TMRUtility.processRencontreEchec( this.actor, this.rencontre);
this.close();
} else {
TMRUtility.processRencontreReussite( this.actor, this.rencontre);
}
console.log("-> matriser", this.currentRencontre);
this.updateValuesDisplay();
}
/* -------------------------------------------- */
@ -67,16 +91,16 @@ export class RdDTMRDialog extends Dialog {
myroll.roll();
val = myroll.total;
if ( val == 7 ) {
rencontre = RdDUtility.rencontreTMRRoll(coordTMR, cellDescr);
rencontre = TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
}
}
if (rencontre) { // Manages it
this.currentRencontre = rencontre;
let myroll = new Roll(rencontre.data.force);
myroll.roll();
rencontre.force = myroll.total;
this.currentRencontre = rencontre;
await this.minimize();
console.log("Dialog !!!!");
let diag = new Dialog( { title: "Rencontre en TMR!",
content: "Vous recontrez un " + rencontre.name + " de force " + myroll.total + "<br>",
buttons: {
@ -106,18 +130,77 @@ export class RdDTMRDialog extends Dialog {
this.actor.performRoll( this.rollData );
}
/* -------------------------------------------- */
updateValuesDisplay() {
let ptsreve = document.getElementById("pointsreve-value");
ptsreve.innerHTML = this.actor.data.data.reve.reve.value;
let tmrpos = document.getElementById("tmr-pos");
let tmr = TMRUtility.getTMRDescription( this.actor.data.data.reve.tmrpos.coord );
tmrpos.innerHTML = this.actor.data.data.reve.tmrpos.coord + " (" + tmr.label + ")";
let etat = document.getElementById("etatgeneral-value");
etat.innerHTML = this.actor.data.data.compteurs.etat.value;
let refoulement = document.getElementById("refoulement-value");
refoulement.innerHTML = this.actor.data.data.reve.refoulement.value;
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>";
}
/* -------------------------------------------- */
manageCaseHumideResult() {
if ( this.toclose )
this.close();
else
this.maximize();
}
/* -------------------------------------------- */
async manageCaseHumide( cellDescr ) {
if ( cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais" ) {
let draconic = this.actor.getBestDraconic();
let carac = this.actor.getCurrentReve();
let level = draconic.data.niveau - 7;
let scoreDef = CONFIG.RDD.resolutionTable[carac][level+10];
let myroll = new Roll("d100");
myroll.roll();
let content = "";
let mycallback;
console.log(">>>>", scoreDef);
if ( myroll.total > scoreDef.score ) {
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> ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score;
this.toclose = true;
} else {
content = "Vous êtes entré sur une case humide, et vous avez <strong>réussi</strong> votre maîtrise ! ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total + " / " + scoreDef.score;
}
let humideDiag = new Dialog( {title: "Case humide",
content: content,
buttons: {
choice: { icon: '<i class="fas fa-check"></i>',
label: "Fermer",
callback: () => this.manageCaseHumideResult()
}
}
}
);
await this.minimize();
humideDiag.render(true);
}
}
/* -------------------------------------------- */
updateSprites( myself )
{
let coordTMR = myself.actor.data.data.reve.tmrpos.coord;
let coordXY = RdDUtility.convertToCellCoord( coordTMR );
let coordXY = TMRUtility.convertToCellCoord( coordTMR );
let basey = (coordXY.x % 2 == 0) ? myself.col1_y : myself.col2_y;
let myx = 28+(coordXY.x * myself.cellw);
let myy = basey+28+(coordXY.y * myself.cellh);
myself.circle.x = myx;
myself.circle.y = myy;
myself.circle.y = myy;
}
/* -------------------------------------------- */
@ -129,7 +212,6 @@ export class RdDTMRDialog extends Dialog {
let canvasRect = origEvent.target.getBoundingClientRect();
let x = origEvent.clientX - canvasRect.left;
let y = origEvent.clientY - canvasRect.top;
//console.log(">>>>", x, y );
let cellx = Math.floor( x / myself.cellw);// [From 0 -> 12]
if (cellx % 2 == 0)
y -= myself.col1_y;
@ -137,43 +219,26 @@ export class RdDTMRDialog extends Dialog {
y -= myself.col2_y;
let celly = Math.floor( y / myself.cellh);// [From 0 -> 14]
let currentPos = RdDUtility.convertToCellCoord(myself.actor.data.data.reve.tmrpos.coord);
if ( Math.abs(cellx - currentPos.x) > 1 || Math.abs(celly - currentPos.y) > 1 ) { // Check if the coord is reachable !
ui.notifications.error( "Vous ne pouvez vous déplacer que sur des cases adjacentes à votre position" );
console.log(">>>>", cellx, celly );
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) ||
(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, et pas en diagonale" );
} else {
let coordTMR = RdDUtility.convertToTMRCoord(cellx, celly);
let cellDescr = RdDUtility.getTMRDescription( coordTMR );
let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly);
let cellDescr = TMRUtility.getTMRDescription( coordTMR );
console.log("TMR column is", coordTMR, cellx, celly, cellDescr, this);
let tmrPos = duplicate(myself.actor.data.data.reve.tmrpos);
tmrPos.coord = coordTMR;
await myself.actor.update( { "data.reve.tmrpos": tmrPos } );
myself.updateSprites(myself);
myself.actor.santeIncDec("fatigue", 1); // moving 1 cell costs 1 fatigue
let fatigueItem = document.getElementById("fatigue-table");
fatigueItem.innerHTML = "<table class='table-fatigue'>" + RdDUtility.makeHTMLfatigueMatrix( myself.actor.data.data.sante.fatigue.value, myself.actor.data.data.sante.endurance.max ).html() + "</table>";
myself.manageRencontre(coordTMR, cellDescr);
myself.updateValuesDisplay();
myself.manageRencontre(coordTMR, cellDescr);
myself.manageCaseHumide( cellDescr );
if ( cellDescr.type == "lac" || cellDescr.type == "fleuve" || cellDescr.type == "marais" ) {
let draconic = myself.actor.getBestDraconic();
let carac = myself.actor.getCurrentReve();
let level = draconic.data.niveau - 7;
let scoreDef = CONFIG.RDD.resolutionTable[carac][draconic.niveau+10];
let myroll = new Roll("d100");
myroll.roll();
let humideDiag = new Dialog( {title: "Case humide",
content: "Vous êtes entré sur une case humide, et vous avez tenté une matrise ("+ draconic.name +") :" + carac + " / " + level + " -> " + myroll.total,
buttons: {
choice: { icon: '<i class="fas fa-check"></i>',
label: "Fermer",
callback: () => myself.maximize()
}
}
}
);
await myself.minimize();
humideDiag.render(true);
}
}
}
@ -184,7 +249,7 @@ export class RdDTMRDialog extends Dialog {
var row = document.getElementById("tmrrow1");
var cell1 = row.insertCell(1);
cell1.append( this.pixiApp.view );
// load the texture we need
this.pixiApp.loader.add('tmr', 'systems/foundryvtt-reve-de-dragon/styles/ui/tmp_main_r1.webp').load((loader, resources) => {
// This creates a texture from a 'bunny.png' image
@ -213,6 +278,13 @@ export class RdDTMRDialog extends Dialog {
this.pixiApp.stage.addChild(this.circle);
//this.updateSprites();
} );
await this.actor.santeIncDec("fatigue", 1); // 1 point defatigue
await this.actor.updatePointsDeReve(-1); // 1 point defatigue
this.updateValuesDisplay();
let cellDescr = TMRUtility.getTMRDescription(this.actor.data.data.reve.tmrpos.coord);
this.manageRencontre( this.actor.data.data.reve.tmrpos.coord,cellDescr );
this.manageCaseHumide( cellDescr );
}
}

View File

@ -66,47 +66,6 @@ const fatigueMarche = { "aise": { "4":1, "6":2, "8":3, "10":4, "12":6 },
"malaise": { "4":2, "6":3, "8":4, "10":6 },
"difficile": { "4":3, "6":4, "8":6 },
"tresdifficile": { "4":4, "6":6 } }
/* -------------------------------------------- */
const TMRMapping = { A1: { type: "cite", label: "Cité VIDE"}, B1: { type:"plaines", label: "Plaines d'ASSORH"}, C1: { type:"necropole", label: "Nécropole de KROAK"}, D1: { type: "fleuve", label: "Fleuve de l'Oubli"}, E1: { type: "monts", label: "Monts de KANAI"},
F1: { type: "cite", label: "Cité GLAUQUE"}, G1: { type: "desolation", label: "Désolation de JAMAIS"}, H1: {type: "lac", label: "Lac d'ANTI-CALME"}, I1: { type: "plaines", label: "Plaines GRISES"}, J1: { type: "monts", label: "Monts FAINEANTS"},
K1: { type: "cite", label: "Cité d'ONKAUS"}, L1: { type: "fleuve", label: "Fleuve de l'Oubli"}, M1: { type: "cite", label: "Cité JALOUSE"},
A2: { type: "desert", label: "Désert de MIEUX"}, B2: { type:"collines", label: "Collines de DAWELL"}, C2: { type:"monts", label: "Monts GLIGNANTS"}, D2: { type: "cite", label: "Cité de FROST"}, E2: { type: "plaines", label: "Plaines de FIASK"},
F2: { type: "lac", label: "Lac de MISERE"}, G2: { type: "marais", label: "Marais NUISANTS"}, H2: {type: "collines", label: "Collines de PARTA"}, I2: { type: "foret", label: "Forêt FADE"}, J2: { type: "desert", label: "Désert de POLY"},
K2: { type: "foret", label: "Forêt TAMEE"}, L2: { type: "fleuve", label: "Fleuve de l'Oubli"}, M2: { type: "necropole", label: "Nécropole de LOGOS"}
}
const rencontresTable = [
{name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1,
cite: "01-25", sanctuaire: "01-25", plaines: "01-20", pont: "01-20", collines: "01-15", forêt: "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,
cite: "26-50", sanctuaire: "26-50", plaines: "21-40", pont: "21-40", collines: "16-30", forêt: "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,
cite: "51-65", sanctuaire: "51-65", plaines: "41-55", pont: "41-55", collines: "31-42", forêt: "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,
cite: "66-70", sanctuaire: "66-70", plaines: "56-60", pont: "56-60", collines: "43-54", forêt: "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,
cite: "71-80", sanctuaire: "71-80", plaines: "61-75", pont: "61-75", collines: "55-69", forêt: "55-69", monts: "45-59", desert: "45-59", fleuve: "38-49",
lac: "38-49", marais: "30-39", gouffre: "30-39", necropole: "21-30", desolation: "21-30" } },
{name:"Briseur de Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "81-85", sanctuaire: "81-85", plaines: "76-82", pont: "76-82", collines: "70-82", forêt: "70-82", monts: "60-75", desert: "60-75", fleuve: "50-65",
lac: "50-65", marais: "40-60", gouffre: "40-60", necropole: "31-50", desolation: "31-50" } },
{name:"Reflet d'ancien Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "86-90", sanctuaire: "86-90", plaines: "83-88", pont: "83-88", collines: "83-88", forêt: "83-88", monts: "76-85", desert: "76-85", fleuve: "66-79",
lac: "66-79", marais: "61-75", gouffre: "61-75", necropole: "51-65", desolation: "51-65" } },
{name:"Tourbillon blanc", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "91-94", sanctuaire: "91-94", plaines: "89-93", pont: "89-93", collines: "89-93", forêt: "89-93", monts: "86-92", desert: "86-92", fleuve: "80-89",
lac: "80-89", marais: "76-86", gouffre: "76-86", necropole: "66-80", desolation: "66-80" } },
{name:"Tourbillon noir", data: { force: "2d8", ignorer: false, derober: true, refoulement: 1,
cite: "95-97", sanctuaire: "95-97", plaines: "94-97", pont: "94-97", collines: "94-97", forêt: "94-97", monts: "93-97", desert: "93-97", fleuve: "90-97",
lac: "90-97", marais: "87-97", gouffre: "90-97", necropole: "81-97", desolation: "81-97" } },
{name:"Rêve de Dragon", data: { force: "1d7", ignorer: false, derober: true, refoulement: 2,
cite: "98-00", sanctuaire: "98-00", plaines: "98-00", pont: "98-00", collines: "98-00", forêt: "98-00", monts: "98-00", desert: "98-00", fleuve: "98-00",
lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } }
]
/* -------------------------------------------- */
export class RdDUtility {
@ -300,9 +259,9 @@ export class RdDUtility {
//Compteurs
//data.compteurs.reve.value = data.carac.reve.value;
data.compteurs.reve.max = data.carac.reve.value;
data.reve.reve.max = data.carac.reve.value;
//data.compteurs.chance.value = data.carac.chance.value;
data.compteurs.chance.max = data.carac.chance.value;
data.compteurs.chance.max = data.carac.chance.value;
}
/* -------------------------------------------- */
@ -558,44 +517,4 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static convertToTMRCoord( x, y )
{
y = y + 1
let letterX = String.fromCharCode(65+x);
return letterX+y
}
/* -------------------------------------------- */
static convertToCellCoord( coordTMR )
{
let x = coordTMR.charCodeAt(0) - 65;
let y = coordTMR.substr(1) - 1;
return {x: x, y: y}
}
/* -------------------------------------------- */
static getTMRDescription( coordTMR)
{
return TMRMapping[coordTMR];
}
/* -------------------------------------------- */
static rencontreTMRRoll( coordTMR, cellDescr )
{
let myroll = new Roll("d100");
myroll.roll();
let val = myroll.total;
//console.log("Rencontre !!!!", val, coordTMR, cellDescr);
for( let renc of rencontresTable) {
let scoreDef = renc.data[cellDescr.type];
let min = scoreDef.substr(0,2);
let max = scoreDef.substr(3,2);
console.log(val, scoreDef, min, max);
if ( val >= min && val <= max) {
return renc;
}
}
}
}

153
module/tmr-utility.js Normal file
View File

@ -0,0 +1,153 @@
/* -------------------------------------------- */
const TMRMapping = { A1: { type: "cite", label: "Cité VIDE"}, B1: { type:"plaines", label: "Plaines d'ASSORH"}, C1: { type:"necropole", label: "Nécropole de KROAK"}, D1: { type: "fleuve", label: "Fleuve de l'Oubli"}, E1: { type: "monts", label: "Monts de KANAI"},
F1: { type: "cite", label: "Cité GLAUQUE"}, G1: { type: "desolation", label: "Désolation de JAMAIS"}, H1: {type: "lac", label: "Lac d'ANTI-CALME"}, I1: { type: "plaines", label: "Plaines GRISES"}, J1: { type: "monts", label: "Monts FAINEANTS"},
K1: { type: "cite", label: "Cité d'ONKAUS"}, L1: { type: "fleuve", label: "Fleuve de l'Oubli"}, M1: { type: "cite", label: "Cité JALOUSE"},
A2: { type: "desert", label: "Désert de MIEUX"}, B2: { type:"collines", label: "Collines de DAWELL"}, C2: { type:"monts", label: "Monts GLIGNANTS"}, D2: { type: "cite", label: "Cité de FROST"}, E2: { type: "plaines", label: "Plaines de FIASK"},
F2: { type: "lac", label: "Lac de MISERE"}, G2: { type: "marais", label: "Marais NUISANTS"}, H2: {type: "collines", label: "Collines de PARTA"}, I2: { type: "foret", label: "Forêt FADE"}, J2: { type: "desert", label: "Désert de POLY"},
K2: { type: "foret", label: "Forêt TAMEE"}, L2: { type: "fleuve", label: "Fleuve de l'Oubli"}, M2: { type: "necropole", label: "Nécropole de LOGOS"}
}
const rencontresTable = [
{name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1,
cite: "01-25", sanctuaire: "01-25", plaines: "01-20", pont: "01-20", collines: "01-15", forêt: "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,
cite: "26-50", sanctuaire: "26-50", plaines: "21-40", pont: "21-40", collines: "16-30", forêt: "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,
cite: "51-65", sanctuaire: "51-65", plaines: "41-55", pont: "41-55", collines: "31-42", forêt: "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,
cite: "66-70", sanctuaire: "66-70", plaines: "56-60", pont: "56-60", collines: "43-54", forêt: "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,
cite: "71-80", sanctuaire: "71-80", plaines: "61-75", pont: "61-75", collines: "55-69", forêt: "55-69", monts: "45-59", desert: "45-59", fleuve: "38-49",
lac: "38-49", marais: "30-39", gouffre: "30-39", necropole: "21-30", desolation: "21-30" } },
{name:"Briseur de Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "81-85", sanctuaire: "81-85", plaines: "76-82", pont: "76-82", collines: "70-82", forêt: "70-82", monts: "60-75", desert: "60-75", fleuve: "50-65",
lac: "50-65", marais: "40-60", gouffre: "40-60", necropole: "31-50", desolation: "31-50" } },
{name:"Reflet d'ancien Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "86-90", sanctuaire: "86-90", plaines: "83-88", pont: "83-88", collines: "83-88", forêt: "83-88", monts: "76-85", desert: "76-85", fleuve: "66-79",
lac: "66-79", marais: "61-75", gouffre: "61-75", necropole: "51-65", desolation: "51-65" } },
{name:"Tourbillon blanc", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,
cite: "91-94", sanctuaire: "91-94", plaines: "89-93", pont: "89-93", collines: "89-93", forêt: "89-93", monts: "86-92", desert: "86-92", fleuve: "80-89",
lac: "80-89", marais: "76-86", gouffre: "76-86", necropole: "66-80", desolation: "66-80" } },
{name:"Tourbillon noir", data: { force: "2d8", ignorer: false, derober: true, refoulement: 1,
cite: "95-97", sanctuaire: "95-97", plaines: "94-97", pont: "94-97", collines: "94-97", forêt: "94-97", monts: "93-97", desert: "93-97", fleuve: "90-97",
lac: "90-97", marais: "87-97", gouffre: "90-97", necropole: "81-97", desolation: "81-97" } },
{name:"Rêve de Dragon", data: { force: "1d7", ignorer: false, derober: true, refoulement: 2,
cite: "98-00", sanctuaire: "98-00", plaines: "98-00", pont: "98-00", collines: "98-00", forêt: "98-00", monts: "98-00", desert: "98-00", fleuve: "98-00",
lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } }
]
/* -------------------------------------------- */
export class TMRUtility {
/* -------------------------------------------- */
static convertToTMRCoord( x, y )
{
y = y + 1
let letterX = String.fromCharCode(65+x);
return letterX+y
}
/* -------------------------------------------- */
static convertToCellCoord( coordTMR )
{
let x = coordTMR.charCodeAt(0) - 65;
let y = coordTMR.substr(1) - 1;
return {x: x, y: y}
}
/* -------------------------------------------- */
static getTMRDescription( coordTMR)
{
return TMRMapping[coordTMR];
}
/* -------------------------------------------- */
static rencontreTMRRoll( coordTMR, cellDescr )
{
let myroll = new Roll("d100");
myroll.roll();
let val = myroll.total;
//console.log("Rencontre !!!!", val, coordTMR, cellDescr);
for( let renc of rencontresTable) {
let scoreDef = renc.data[cellDescr.type];
let min = scoreDef.substr(0,2);
let max = scoreDef.substr(3,2);
//console.log(val, scoreDef, min, max);
if ( val >= min && val <= max) {
return renc;
}
}
}
/* -------------------------------------------- */
static getRandomLocationType( coordTMR ) {
let descr = this.getTMRDescription( coordTMR );
// TODO random get same type
}
/* -------------------------------------------- */
static processRencontreReussite( actor, rencontre ) {
}
/* -------------------------------------------- */
static async processRencontreEchec( actor, rencontre ) {
let msg = "Vous avez échoué à votre maîtrise ! ";
if (rencontre.name == "Messagers des Rêves") {
msg += "Le Messager des Rêves s'éloigne de vous !";
} else if (rencontre.name == "Passeur des Rêves") {
msg += "Le Passeur des Rêves s'éloigne de vous !";
} else if (rencontre.name == "Fleur des Rêves") {
msg += "La Fleur des rêves s'éloigne de vous et se perd dans les Terres Médianes";
} else if (rencontre.name == "Mangeur de Rêve") {
await actor.updatePointsDeReve( -rencontre.force );
msg += "Ce Mangeur des Rêves croque votre Rêve ! Vous perdez " + rencontre.force + " points de rêve actuels, votre nouveau total est de " + actor.data.data.reve.reve.value;
} else if (rencontre.name == "Changeur de Rêve") {
let coordTMR = actor.data.data.reve.tmrpos.coord;
let newcoordTMR = this.getRandomLocationType(coordTMR);
msg += "Vous avez été téléporté en "; // TODO
} else if (rencontre.name == "Briseur de Rêve") {
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
} else if (rencontre.name == "Reflet d'ancien Rêve") {
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
} else if (rencontre.name == "Tourbillon blanc") {
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
} else if (rencontre.name == "Tourbillon noir") {
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
} else if (rencontre.name == "Rêve de Dragon") {
}
}
/* -------------------------------------------- */
static getSouffle( ) {
}
/* -------------------------------------------- */
static getQueue( ) {
}
/* -------------------------------------------- */
static getTete( ) {
}
/* -------------------------------------------- */
static getOmbre( ) {
}
}

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,10 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "L'implémentation de Rêve de Dragon pour FoundryVTT",
"version": "0.7.12",
"version": "0.7.14",
"minimumCoreVersion": "0.6.0",
"compatibleCoreVersion": "0.6.2",
"templateVersion": 18,
"templateVersion": 19,
"author": "LeRatierBretonnien",
"esmodules": [ "module/rdd-main.js", "module/hook-renderChatLog.js" ],
"styles": ["styles/simple.css"],

View File

@ -228,15 +228,27 @@
"label": "Position TMR"
},
"reserve": {
"reserveList": []
"list": []
},
"rencontre": {
"rencontreList": []
"list": []
},
"refoulement": {
"value": 0,
"label": "Points de Refoulement"
}
},
"queues": {
"list": []
},
"souffles": {
"list": []
},
"tetes": {
"list": []
},
"ombres": {
"list": []
}
},
"compteurs": {
"sust": {

View File

@ -303,8 +303,8 @@
<div class="tab hautreve" data-group="primary" data-tab="hautreve" style="height:200px">
<div>
<li class="item flexrow" >Points de Rêve actuels : <input class="pointsreve-value flexrow" type="text" name="data.reve.reve.value" value="{{data.reve.reve.value}}" data-dtype="Number"/></li>
<li class="item flexrow" >Position en TMR : {{data.reve.tmrpos.coord}}</li>
<li class="item flexrow" >Refoulement : {{data.reve.refoulement.value}}</li>
<li class="item flexrow" >Position en TMR : {{data.reve.tmrpos.coord}} </li>
<li class="item flexrow" >Refoulement : {{data.reve.refoulement.value}} </li>
</div>
<div>
<span>Sorts:</span>

View File

@ -4,18 +4,49 @@
<table id="tmrsheet">
<tr id="tmrrow1">
<td>
<div class="flex-group-center flex-fatigue">
Rêve Actuel : <span id="pointsreve-value">0</span>
</div>
<div class="flex-group-center flex-fatigue">
Coordonnées : <span id="tmr-pos">0</span>
</div>
<div class="flex-group-center flex-fatigue">
Etat général : <span id="etatgeneral-value">0</span>
</div>
<div class="flex-group-center flex-fatigue">
Refoulement : <span id="refoulement-value">0</span>
</div>
<div class="flex-group-center flex-fatigue">
Fatigue
<span id="fatigue-table">{{{fatigueHTML}}}</span>
</div>
<div class="form-group">
<label for="categorie">Etat général</label><label>{{numberFormat etat decimals=0 sign=true}}</label>
<label for="categorie">Caractéristique Rêve : </label><label>{{caracReve}}</label>
</div>
<div class="flex-group-center">
Draconic : <span id="draconic-list">
<select name="draconic" id="draconic-list" data-dtype="String">
{{#select draconic}}
{{>"systems/foundryvtt-reve-de-dragon/templates/sort-draconic.html"}}
{{/select}}
</select>
</span>
</div>
<div class="flex-group-center">
Sorts : <span id="sorts-list">
<select name="sort" id="sort-list" data-dtype="String">
{{#select draconic}}
{{#each sort}}
<option value={{this.name}}>{{this.name}}</option>
{{/each}}
{{/select}}
</select>
</span>
</div>
<div class="form-group">
<label>Ajustement final : </label><label id="roll-param">10 / 0</label>
</div>
</td>
</tr>
</table>