#27 Gestion des rencontres
This commit is contained in:
parent
163e85a82f
commit
c6ed8db2fc
@ -17,7 +17,8 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
width: 640,
|
width: 640,
|
||||||
height: 720,
|
height: 720,
|
||||||
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}],
|
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac"}],
|
||||||
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}]
|
dragDrop: [{dragSelector: ".item-list .item", dropSelector: null}],
|
||||||
|
editCaracComp: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +106,10 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
data.ajustementsConditions = CONFIG.RDD.ajustementsConditions;
|
data.ajustementsConditions = CONFIG.RDD.ajustementsConditions;
|
||||||
data.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
data.difficultesLibres = CONFIG.RDD.difficultesLibres;
|
||||||
|
|
||||||
|
// Gestion du lock/unlock des zones éditables (carac+compétences)
|
||||||
|
data.data.editCaracComp = this.options.editCaracComp;
|
||||||
|
data.data.lockUnlockText = (this.options.editCaracComp) ? "Bloquer" : "Debloquer";
|
||||||
|
|
||||||
// low is normal, this the base used to compute the grid.
|
// low is normal, this the base used to compute the grid.
|
||||||
data.data.fatigue = {
|
data.data.fatigue = {
|
||||||
malus: RdDUtility.calculMalusFatigue(data.data.sante.fatigue.value, data.data.sante.endurance.max),
|
malus: RdDUtility.calculMalusFatigue(data.data.sante.fatigue.value, data.data.sante.endurance.max),
|
||||||
@ -113,7 +118,6 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
RdDUtility.filterItemsPerTypeForSheet(data );
|
RdDUtility.filterItemsPerTypeForSheet(data );
|
||||||
data.data.sortReserve = data.data.reve.reserve.list;
|
data.data.sortReserve = data.data.reve.reserve.list;
|
||||||
|
|
||||||
RdDUtility.buildArbreDeConteneur( this, data );
|
RdDUtility.buildArbreDeConteneur( this, data );
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@ -267,19 +271,31 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
item.sheet.render(true);
|
item.sheet.render(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// On carac change
|
if (this.options.editCaracComp) {
|
||||||
html.find('.carac-value').change((event) => {
|
// On carac change
|
||||||
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
|
html.find('.carac-value').change((event) => {
|
||||||
//console.log("Value changed :", event, caracName);
|
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
|
||||||
this.actor.updateCarac( caracName, parseInt(event.target.value) );
|
//console.log("Value changed :", event, caracName);
|
||||||
} );
|
this.actor.updateCarac( caracName, parseInt(event.target.value) );
|
||||||
|
} );
|
||||||
|
// On competence change
|
||||||
|
html.find('.competence-value').change((event) => {
|
||||||
|
let compName = event.currentTarget.attributes.compname.value;
|
||||||
|
//console.log("Competence changed :", compName);
|
||||||
|
this.actor.updateCompetence( compName, parseInt(event.target.value) );
|
||||||
|
} );
|
||||||
|
// On competence xp change
|
||||||
|
html.find('.competence-xp').change((event) => {
|
||||||
|
let compName = event.currentTarget.attributes.compname.value;
|
||||||
|
this.actor.updateCompetenceXP( compName, parseInt(event.target.value) );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
// On competence change
|
// Gestion du bouton lock/unlock
|
||||||
html.find('.competence-value').change((event) => {
|
html.find('.lock-unlock-sheet a').click((event) => {
|
||||||
let compName = event.currentTarget.attributes.compname.value;
|
this.options.editCaracComp = !this.options.editCaracComp;
|
||||||
//console.log("Competence changed :", compName);
|
this.render(true);
|
||||||
this.actor.updateCompetence( compName, parseInt(event.target.value) );
|
});
|
||||||
} );
|
|
||||||
|
|
||||||
// On pts de reve change
|
// On pts de reve change
|
||||||
html.find('.pointsreve-value').change((event) => {
|
html.find('.pointsreve-value').change((event) => {
|
||||||
@ -295,12 +311,6 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
this.actor.setPointsDeSeuil(event.currentTarget.value);
|
this.actor.setPointsDeSeuil(event.currentTarget.value);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// On competence xp change
|
|
||||||
html.find('.competence-xp').change((event) => {
|
|
||||||
let compName = event.currentTarget.attributes.compname.value;
|
|
||||||
this.actor.updateCompetenceXP( compName, parseInt(event.target.value) );
|
|
||||||
} );
|
|
||||||
|
|
||||||
// On stress change
|
// On stress change
|
||||||
html.find('.compteur-edit').change((event) => {
|
html.find('.compteur-edit').change((event) => {
|
||||||
let fieldName = event.currentTarget.attributes.name.value;
|
let fieldName = event.currentTarget.attributes.name.value;
|
||||||
|
@ -46,6 +46,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
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 = [];
|
this.allTokens = [];
|
||||||
|
this.rencontreState = "aucune";
|
||||||
this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
|
this.pixiApp = new PIXI.Application({ width: 720, height: 860 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +102,44 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
console.log("-> refouler", this.currentRencontre)
|
console.log("-> refouler", this.currentRencontre)
|
||||||
this.updateValuesDisplay();
|
this.updateValuesDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
colorierZone( locList) {
|
||||||
|
this.currentRencontre.graphics = []; // Keep track of rectangles to delete it
|
||||||
|
this.currentRencontre.locList = duplicate(locList); // And track of allowed location
|
||||||
|
for (let loc of locList) {
|
||||||
|
let rect = this._getCaseRectangleCoord( loc);
|
||||||
|
var rectDraw = new PIXI.Graphics();
|
||||||
|
rectDraw.beginFill(0xFFFF00, 0.3);
|
||||||
|
// set the line style to have a width of 5 and set the color to red
|
||||||
|
rectDraw.lineStyle(5, 0xFF0000);
|
||||||
|
// draw a rectangle
|
||||||
|
rectDraw.drawRect(rect.x, rect.y, rect.w, rect.h);
|
||||||
|
this.pixiApp.stage.addChild(rectDraw);
|
||||||
|
this.currentRencontre.graphics.push(rectDraw); // garder les objets pour gestion post-click
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/** Gère les rencontres avec du post-processing graphique (passeur, messagers, tourbillons, ...) */
|
||||||
|
rencontrePostProcess( rencontreData) {
|
||||||
|
if (!rencontreData) return; // Sanity check
|
||||||
|
this.rencontreState = rencontreData.state; // garder la trace de l'état en cours
|
||||||
|
if ( this.rencontreState == "passeur") {
|
||||||
|
console.log("Processing passeur");
|
||||||
|
// Récupère la liste des cases à portées
|
||||||
|
let locList = TMRUtility.getTMRArea(this.actor.data.data.reve.tmrpos.coord, this.currentRencontre.force, tmrConstants );
|
||||||
|
this.colorierZone( locList );
|
||||||
|
} else if ( this.rencontreState == "messager") {
|
||||||
|
console.log("Processing messager");
|
||||||
|
// Récupère la liste des cases à portées
|
||||||
|
let locList = TMRUtility.getTMRArea(this.actor.data.data.reve.tmrpos.coord, this.currentRencontre.force, tmrConstants );
|
||||||
|
this.colorierZone( locList );
|
||||||
|
} else {
|
||||||
|
this.currentRencontre = undefined; // Cleanup, not used anymore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async maitriser(data) {
|
async maitriser(data) {
|
||||||
this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
|
this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
|
||||||
@ -117,16 +156,22 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
let message = "<br><strong>Test : Rêve actuel / " + draconic.name + " / " + this.currentRencontre.name + "</strong>" + "<br>"
|
let message = "<br><strong>Test : Rêve actuel / " + draconic.name + " / " + this.currentRencontre.name + "</strong>" + "<br>"
|
||||||
+ RdDResolutionTable.explain(rolled);
|
+ RdDResolutionTable.explain(rolled);
|
||||||
|
|
||||||
|
let rencontreData
|
||||||
if (rolled.isEchec) {
|
if (rolled.isEchec) {
|
||||||
message += await TMRUtility.processRencontreEchec(this.actor, this.currentRencontre, rolled, this);
|
rencontreData = await TMRUtility.processRencontreEchec(this.actor, this.currentRencontre, rolled, this);
|
||||||
|
message += rencontreData.message;
|
||||||
this._tellToUser("Vous avez <strong>échoué</strong> à maîtriser un " + this.currentRencontre.name + " de force " + 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 !" + message);
|
+ "<br>Vous quittez brutalement les Terres Médianes !" + message);
|
||||||
if (this.currentRencontre.data.quitterTMR) // Selon les rencontres, quitter TMR ou pas
|
if (this.currentRencontre.data.quitterTMR) // Selon les rencontres, quitter TMR ou pas
|
||||||
this.close();
|
this.close();
|
||||||
} else {
|
} else {
|
||||||
message += await TMRUtility.processRencontreReussite(this.actor, this.currentRencontre, rolled);
|
rencontreData = await TMRUtility.processRencontreReussite(this.actor, this.currentRencontre, rolled);
|
||||||
|
message += rencontreData.message;
|
||||||
this._tellToUser("Vous avez <strong>réussi</strong> à maîtriser un " + this.currentRencontre.name + " de force " + this.currentRencontre.force + message);
|
this._tellToUser("Vous avez <strong>réussi</strong> à maîtriser un " + this.currentRencontre.name + " de force " + this.currentRencontre.force + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.rencontrePostProcess( rencontreData );
|
||||||
|
|
||||||
console.log("-> matriser", this.currentRencontre);
|
console.log("-> matriser", this.currentRencontre);
|
||||||
this.updateValuesDisplay();
|
this.updateValuesDisplay();
|
||||||
}
|
}
|
||||||
@ -154,7 +199,7 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr); To test
|
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||||
|
|
||||||
if (rencontre) { // Manages it
|
if (rencontre) { // Manages it
|
||||||
if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres
|
if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres
|
||||||
@ -276,6 +321,19 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
processClickPostRencontre( coord ) {
|
||||||
|
let deplacementType = "erreur";
|
||||||
|
if (this.rencontreState == "passeur" || this.rencontreState == "messager") {
|
||||||
|
let isInArea = this.currentRencontre.locList.find(locCoord => locCoord == coord );
|
||||||
|
if ( isInArea ) { // OK !
|
||||||
|
deplacementType = "saut";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async deplacerDemiReve(event) {
|
async deplacerDemiReve(event) {
|
||||||
if (this.viewOnly) {
|
if (this.viewOnly) {
|
||||||
@ -288,12 +346,19 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
let cellx = eventCoord.cellx;
|
let cellx = eventCoord.cellx;
|
||||||
let celly = eventCoord.celly;
|
let celly = eventCoord.celly;
|
||||||
console.log("deplacerDemiReve >>>>", cellx, celly);
|
console.log("deplacerDemiReve >>>>", 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 (RdDTMRDialog._horsDePortee(currentPos, cellx, celly)) {
|
// Validation de la case de destination (gestion du cas des rencontres qui peuvent téléporter)
|
||||||
ui.notifications.error("Vous ne pouvez vous déplacer que sur des cases adjacentes à votre position");
|
let deplacementType = "erreur";
|
||||||
|
if ( this.rencontreState == "aucune") { // Pas de recontre en post-processing, donc deplacement normal
|
||||||
|
if ( !RdDTMRDialog._horsDePortee(currentPos, cellx, celly)) {
|
||||||
|
deplacementType = "normal";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
deplacementType = this.processClickPostRencontre( currentPos );
|
||||||
|
}
|
||||||
|
// Si le deplacement est valide
|
||||||
|
if ( deplacementType == "normal" || deplacementType == "saut") {
|
||||||
let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly);
|
let coordTMR = TMRUtility.convertToTMRCoord(cellx, celly);
|
||||||
let cellDescr = TMRUtility.getTMRDescription(coordTMR);
|
let cellDescr = TMRUtility.getTMRDescription(coordTMR);
|
||||||
|
|
||||||
@ -306,9 +371,13 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
myself.nbFatigue += 1;
|
myself.nbFatigue += 1;
|
||||||
myself.updateValuesDisplay();
|
myself.updateValuesDisplay();
|
||||||
|
|
||||||
myself.manageRencontre(coordTMR, cellDescr);
|
if ( deplacementType == "normal") { // Pas de rencontres après un saut de type passeur/changeur/...
|
||||||
|
myself.manageRencontre(coordTMR, cellDescr);
|
||||||
|
}
|
||||||
myself.manageCaseHumide(cellDescr);
|
myself.manageCaseHumide(cellDescr);
|
||||||
await myself.declencheSortEnReserve(coordTMR);
|
await myself.declencheSortEnReserve(coordTMR);
|
||||||
|
} else {
|
||||||
|
ui.notifications.error("Vous ne pouvez vous déplacer que sur des cases adjacentes à votre position ou valides dans le cas d'une rencontre");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,6 +517,16 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
myself._setTokenPosition(myself.demiReve);
|
myself._setTokenPosition(myself.demiReve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/** Retourne les coordonnées x, h, w, h du rectangle d'une case donnée */
|
||||||
|
_getCaseRectangleCoord( coord ) {
|
||||||
|
let coordXY = TMRUtility.convertToCellCoord( coord );
|
||||||
|
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
||||||
|
let x = tmrConstants.gridx + (coordXY.x * tmrConstants.cellw) - (tmrConstants.cellw /2);
|
||||||
|
let y = tmrConstants.gridy + (coordXY.y * tmrConstants.cellh) - (tmrConstants.cellh /2) + decallagePairImpair;
|
||||||
|
return {x: x, y: y, w: tmrConstants.cellw, h: tmrConstants.cellh}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_setTokenPosition(token) {
|
_setTokenPosition(token) {
|
||||||
let coordXY = TMRUtility.convertToCellCoord(token.coordTMR());
|
let coordXY = TMRUtility.convertToCellCoord(token.coordTMR());
|
||||||
|
@ -240,23 +240,9 @@ const rencontresTable = [
|
|||||||
lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } }
|
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 {
|
export class TMRUtility {
|
||||||
|
|
||||||
static getTMRConstants() {
|
|
||||||
return tmrConstants;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static convertToTMRCoord( x, y )
|
static convertToTMRCoord( x, y )
|
||||||
{
|
{
|
||||||
@ -290,9 +276,9 @@ export class TMRUtility {
|
|||||||
rencontre.coord = coordTMR;
|
rencontre.coord = coordTMR;
|
||||||
}
|
}
|
||||||
// Forced
|
// Forced
|
||||||
//rencontre = rencontresTable[4];
|
rencontre = rencontresTable[0];
|
||||||
//rencontre.force = 11;
|
rencontre.force = 1;
|
||||||
//rencontre.coord = coordTMR;
|
rencontre.coord = coordTMR;
|
||||||
|
|
||||||
return rencontre;
|
return rencontre;
|
||||||
}
|
}
|
||||||
@ -379,12 +365,16 @@ export class TMRUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async processRencontreReussite( actor, rencontre, rolled ) {
|
static async processRencontreReussite( actor, rencontre, rolled ) {
|
||||||
let msg = "<br>";
|
let msg = "<br>";
|
||||||
|
let state = "aucune";
|
||||||
|
|
||||||
console.log("processRencontreReussite", actor, rencontre);
|
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 !";
|
||||||
|
state = "messager";
|
||||||
|
|
||||||
} else if (rencontre.name == "Passeur des Rêves") {
|
} else if (rencontre.name == "Passeur des Rêves") {
|
||||||
msg += "Le Passeur des Rêves vous téléporte sur une case à XX !";
|
msg += "Le Passeur des Rêves vous permet de vous téléporter à " + rencontre.force + " cases !";
|
||||||
|
state = "passeur";
|
||||||
|
|
||||||
} else if (rencontre.name == "Fleur des Rêves") {
|
} else if (rencontre.name == "Fleur des Rêves") {
|
||||||
await actor.updatePointsDeReve( rencontre.force );
|
await actor.updatePointsDeReve( rencontre.force );
|
||||||
@ -419,12 +409,13 @@ export class TMRUtility {
|
|||||||
msg += "Vous maîtrisez le Rêve de Dragon !"
|
msg += "Vous maîtrisez le Rêve de Dragon !"
|
||||||
msg += actor.appliquerReveDeDragon(rolled, rencontre.force);
|
msg += actor.appliquerReveDeDragon(rolled, rencontre.force);
|
||||||
}
|
}
|
||||||
return msg;
|
return { msg: msg, state: state };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async processRencontreEchec( actor, rencontre, rolled, tmrDialog ) {
|
static async processRencontreEchec( actor, rencontre, rolled, tmrDialog ) {
|
||||||
let msg = "<br>";
|
let msg = "<br>";
|
||||||
|
let state = "aucune";
|
||||||
|
|
||||||
if (rencontre.name == "Messagers des Rêves") {
|
if (rencontre.name == "Messagers des Rêves") {
|
||||||
msg += "Le Messager des Rêves s'éloigne de vous !";
|
msg += "Le Messager des Rêves s'éloigne de vous !";
|
||||||
@ -453,18 +444,21 @@ export class TMRUtility {
|
|||||||
|
|
||||||
} else if (rencontre.name == "Reflet d'ancien Rêve") {
|
} else if (rencontre.name == "Reflet d'ancien Rêve") {
|
||||||
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
||||||
|
state = "reflet"
|
||||||
|
|
||||||
} else if (rencontre.name == "Tourbillon blanc") {
|
} else if (rencontre.name == "Tourbillon blanc") {
|
||||||
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
||||||
|
state = "tourbillonblanc";
|
||||||
|
|
||||||
} else if (rencontre.name == "Tourbillon noir") {
|
} else if (rencontre.name == "Tourbillon noir") {
|
||||||
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
msg += "Votre Rêve est Brisé, vous quittez les Terres Médianes";
|
||||||
|
state = "tourbillonnoir";
|
||||||
|
|
||||||
} else if (rencontre.name == "Rêve de Dragon") {
|
} else if (rencontre.name == "Rêve de Dragon") {
|
||||||
msg += "Le Rêve de Dragon tourne au cauchemar !"
|
msg += "Le Rêve de Dragon tourne au cauchemar !"
|
||||||
msg += actor.appliquerReveDeDragon(rolled, rencontre.force);
|
msg += actor.appliquerReveDeDragon(rolled, rencontre.force);
|
||||||
}
|
}
|
||||||
return msg;
|
return { msg: msg, state: state };
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -502,7 +496,7 @@ export class TMRUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static computeRealPictureCoordinates( coordXY ) {
|
static computeRealPictureCoordinates( coordXY, tmrConstants ) {
|
||||||
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
let decallagePairImpair = (coordXY.x % 2 == 0) ? tmrConstants.col1_y : tmrConstants.col2_y;
|
||||||
return {
|
return {
|
||||||
x: tmrConstants.gridx + (coordXY.x * tmrConstants.cellw),
|
x: tmrConstants.gridx + (coordXY.x * tmrConstants.cellw),
|
||||||
@ -514,15 +508,15 @@ export class TMRUtility {
|
|||||||
/** Returns a list of case inside a given distance
|
/** Returns a list of case inside a given distance
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static getTMRArea( coord, distance ) {
|
static getTMRArea( coord, distance, tmrConstants ) {
|
||||||
let pos = this.convertToCellCoord( coord );
|
let pos = this.convertToCellCoord( coord );
|
||||||
let posPic = this.computeRealPictureCoordinates( pos );
|
let posPic = this.computeRealPictureCoordinates( pos, tmrConstants );
|
||||||
let caseList = [];
|
let caseList = [];
|
||||||
for (let x=pos.x-distance; x<=pos.x+distance; x++ ) { // Loop thru lines
|
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
|
for (let y=pos.y-distance; y<=pos.y+distance; y++ ) { // Loop thru lines
|
||||||
//console.log("Parsing position", x, y);
|
//console.log("Parsing position", x, y);
|
||||||
if ( this._checkTMRCoord(x, y) ) { // Coordinate is valie
|
if ( this._checkTMRCoord(x, y) ) { // Coordinate is valie
|
||||||
let posPicNow = this.computeRealPictureCoordinates( {x: x, y: y} );
|
let posPicNow = this.computeRealPictureCoordinates( {x: x, y: y}, tmrConstants );
|
||||||
let dist = Math.sqrt(Math.pow(posPicNow.x - posPic.x,2) + Math.pow(posPicNow.y - posPic.y, 2)) / tmrConstants.cellw;
|
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) {
|
if ( dist < distance+0.5) {
|
||||||
caseList.push( this.convertToTMRCoord(x, y) ); // Inside the area
|
caseList.push( this.convertToTMRCoord(x, y) ); // Inside the area
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "foundryvtt-reve-de-dragon",
|
"name": "foundryvtt-reve-de-dragon",
|
||||||
"title": "Rêve de Dragon",
|
"title": "Rêve de Dragon",
|
||||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||||
"version": "0.9.63",
|
"version": "0.9.64",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 47,
|
"templateVersion": 47,
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
<span class="tooltiptext">{{{data.fatigue.html}}}</span>
|
<span class="tooltiptext">{{{data.fatigue.html}}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="lock-unlock-sheet">
|
||||||
|
<span><a>{{data.lockUnlockText}}</a></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow flex-wound">
|
<div class="flexrow flex-wound">
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
@ -75,8 +78,8 @@
|
|||||||
{{#if carac.derivee}}
|
{{#if carac.derivee}}
|
||||||
<label class="competence-value flexrow">{{carac.value}}</label>
|
<label class="competence-value flexrow">{{carac.value}}</label>
|
||||||
{{else}}
|
{{else}}
|
||||||
<input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}"/>
|
<input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.data.editCaracComp}}disabled{{/unless}} />
|
||||||
<input class="competence-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number"/>
|
<input class="competence-xp flexrow" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}} />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -115,8 +118,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.generale[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.generale[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.generale[{{key}}].data.value" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.generale[{{key}}].data.value" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.generale[{{key}}]].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.generale[{{key}}]].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -133,8 +136,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.particuliere[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.particuliere[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.particuliere[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -150,8 +153,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.specialisee[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.specialisee[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.specialisee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -170,8 +173,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.melee[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.melee[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.melee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.melee[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.melee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.melee[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -188,8 +191,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.tir[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.tir[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.tir[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.tir[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.tir[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.tir[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -206,8 +209,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.lancer[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.lancer[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.lancer[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.lancer[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"{{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.lancer[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.lancer[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -224,8 +227,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.connaissance[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.connaissance[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.connaissance[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
@ -242,8 +245,8 @@
|
|||||||
<li class="item flexrow" data-item-id="{{comp._id}}">
|
<li class="item flexrow" data-item-id="{{comp._id}}">
|
||||||
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
<img class="sheet-competence-img" src="{{comp.img}}"/>
|
||||||
<span class="competence-label" name="data.competenceByCategory.draconic[{{key}}].name"><a>{{comp.name}}</a></span>
|
<span class="competence-label" name="data.competenceByCategory.draconic[{{key}}].name"><a>{{comp.name}}</a></span>
|
||||||
<input class="competence-value" type="text" name="data.competenceByCategory.draconic[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"/>
|
<input class="competence-value" type="text" name="data.competenceByCategory.draconic[{{key}}].data.niveau" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<input class="competence-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number"/>
|
<input class="competence-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
|
||||||
<div class="item-controls">
|
<div class="item-controls">
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
|
Loading…
Reference in New Issue
Block a user