#27 - Gestion du Changeur de Rêve
This commit is contained in:
parent
a5adacc5b9
commit
8ec2a43cf3
@ -116,9 +116,10 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
+ RdDResolutionTable.explain(rolled);
|
+ RdDResolutionTable.explain(rolled);
|
||||||
|
|
||||||
if (rolled.isEchec) {
|
if (rolled.isEchec) {
|
||||||
message += await TMRUtility.processRencontreEchec(this.actor, this.currentRencontre, rolled);
|
message += await TMRUtility.processRencontreEchec(this.actor, this.currentRencontre, rolled, this);
|
||||||
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
|
||||||
this.close();
|
this.close();
|
||||||
} else {
|
} else {
|
||||||
message += await TMRUtility.processRencontreReussite(this.actor, this.currentRencontre, rolled);
|
message += await TMRUtility.processRencontreReussite(this.actor, this.currentRencontre, rolled);
|
||||||
@ -141,13 +142,15 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
this.currentRencontre = undefined;
|
this.currentRencontre = undefined;
|
||||||
let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR);
|
let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR);
|
||||||
if (rencontre == undefined) {
|
if (rencontre == undefined) {
|
||||||
let deRencontre = new Roll("d7").roll();
|
let myRoll = new Roll("d7").roll();
|
||||||
if (deRencontre.total == 7) {
|
if (myRoll.total == 7) {
|
||||||
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr); To test
|
||||||
|
|
||||||
if (rencontre) { // Manages it
|
if (rencontre) { // Manages it
|
||||||
|
if (rencontre.rencontre) rencontre = rencontre.rencontre; // Manage stored rencontres
|
||||||
console.log("manageRencontre", rencontre)
|
console.log("manageRencontre", rencontre)
|
||||||
this.currentRencontre = duplicate(rencontre);
|
this.currentRencontre = duplicate(rencontre);
|
||||||
|
|
||||||
@ -304,8 +307,12 @@ export class RdDTMRDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async forceDemiRevePosition( coordTMR ) {
|
async forceDemiRevePosition( coordTMR ) {
|
||||||
await actor.updateCoordTMR(coordTMR);
|
await this.actor.updateCoordTMR(coordTMR);
|
||||||
this._updateDemiReve(this);
|
this._updateDemiReve(this);
|
||||||
|
let cellDescr = TMRUtility.getTMRDescription(coordTMR);
|
||||||
|
this.manageRencontre(coordTMR, cellDescr);
|
||||||
|
this.manageCaseHumide(cellDescr);
|
||||||
|
await this.declencheSortEnReserve(coordTMR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -56,7 +56,7 @@ const TMRMapping = {
|
|||||||
J4: { type: "collines", label: "Collines d’Encre"},
|
J4: { type: "collines", label: "Collines d’Encre"},
|
||||||
K4: { type: "pont", label: "Pont de Fah"},
|
K4: { type: "pont", label: "Pont de Fah"},
|
||||||
L4: { type: "sanctuaire", label: "Sanctuaire Mauve"},
|
L4: { type: "sanctuaire", label: "Sanctuaire Mauve"},
|
||||||
M4: { type: "gouffre ", label: "Gouffre Grisant"},
|
M4: { type: "gouffre", label: "Gouffre Grisant"},
|
||||||
|
|
||||||
A5: { type: "plaines", label: "Plaines de Trilkh"},
|
A5: { type: "plaines", label: "Plaines de Trilkh"},
|
||||||
B5: { type: "collines", label: "Collines de Tanegy"},
|
B5: { type: "collines", label: "Collines de Tanegy"},
|
||||||
@ -208,35 +208,35 @@ const TMRMapping = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rencontresTable = [
|
const rencontresTable = [
|
||||||
{name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1,
|
{name:"Messagers des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
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" } },
|
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,
|
{name:"Passeur des Rêves", data: { force: "2d4", ignorer: true, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
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" } },
|
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,
|
{name:"Fleur des Rêves", data: { force: "1d6", ignorer: true, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
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" } },
|
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,
|
{name:"Mangeur de Rêve", data: { force: "1d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
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" } },
|
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,
|
{name:"Changeur de Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: false,
|
||||||
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",
|
cite: "71-80", sanctuaire: "71-80", plaines: "61-75", pont: "61-75", collines: "55-69", foret: "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" } },
|
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,
|
{name:"Briseur de Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
cite: "81-85", sanctuaire: "81-85", plaines: "76-82", pont: "76-82", collines: "70-82", foret: "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" } },
|
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,
|
{name:"Reflet d'ancien Rêve", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1,quitterTMR: true,
|
||||||
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",
|
cite: "86-90", sanctuaire: "86-90", plaines: "83-88", pont: "83-88", collines: "83-88", foret: "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" } },
|
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,
|
{name:"Tourbillon blanc", data: { force: "2d6", ignorer: false, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
cite: "91-94", sanctuaire: "91-94", plaines: "89-93", pont: "89-93", collines: "89-93", foret: "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" } },
|
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,
|
{name:"Tourbillon noir", data: { force: "2d8", ignorer: false, derober: true, refoulement: 1, quitterTMR: true,
|
||||||
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",
|
cite: "95-97", sanctuaire: "95-97", plaines: "94-97", pont: "94-97", collines: "94-97", foret: "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" } },
|
lac: "90-97", marais: "87-97", gouffre: "90-97", necropole: "81-97", desolation: "81-97" } },
|
||||||
{name:"Rêve de Dragon", data: { force: "1ddr + 7", ignorer: false, derober: true, refoulement: 2,
|
{name:"Rêve de Dragon", data: { force: "1ddr + 7", ignorer: false, derober: true, refoulement: 2, quitterTMR: true,
|
||||||
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",
|
cite: "98-00", sanctuaire: "98-00", plaines: "98-00", pont: "98-00", collines: "98-00", foret: "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" } }
|
lac: "98-00", marais: "98-00", gouffre: "98-00", necropole: "98-00", desolation: "98-00" } }
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -275,6 +275,11 @@ export class TMRUtility {
|
|||||||
rencontre.force = this.evaluerForceRencontre(rencontre);
|
rencontre.force = this.evaluerForceRencontre(rencontre);
|
||||||
rencontre.coord = coordTMR;
|
rencontre.coord = coordTMR;
|
||||||
}
|
}
|
||||||
|
// Forced
|
||||||
|
//rencontre = rencontresTable[4];
|
||||||
|
//rencontre.force = 11;
|
||||||
|
//rencontre.coord = coordTMR;
|
||||||
|
|
||||||
return rencontre;
|
return rencontre;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +292,7 @@ export class TMRUtility {
|
|||||||
}
|
}
|
||||||
typeTMR = typeTMR.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
typeTMR = typeTMR.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||||
for( let rencontre of rencontresTable) {
|
for( let rencontre of rencontresTable) {
|
||||||
|
console.log("TMR !!!", typeTMR, roll);
|
||||||
let scoreDef = rencontre.data[typeTMR];
|
let scoreDef = rencontre.data[typeTMR];
|
||||||
let min = scoreDef.substr(0,2);
|
let min = scoreDef.substr(0,2);
|
||||||
let max = scoreDef.substr(3,2);
|
let max = scoreDef.substr(3,2);
|
||||||
@ -374,12 +380,13 @@ export class TMRUtility {
|
|||||||
msg += "Ce Mangeur des Rêves disparait !"
|
msg += "Ce Mangeur des Rêves disparait !"
|
||||||
|
|
||||||
} else if (rencontre.name == "Changeur de Rêve") {
|
} else if (rencontre.name == "Changeur de Rêve") {
|
||||||
msg += "Ce Changeur des Rêves vous propose de vous déplacer sur une autre case de même type."
|
msg += "Ce Changeur des Rêves vous propose de vous déplacer sur une autre case de même type.<ol>"
|
||||||
let locList = this.getLocationTypeList( actor.data.data.reve.tmrpos.coord );
|
let locList = this.getLocationTypeList( actor.data.data.reve.tmrpos.coord );
|
||||||
for ( let coord of locList) {
|
for ( let coord of locList) {
|
||||||
let caseTMR = TMRMapping[coord];
|
let caseTMR = TMRMapping[coord];
|
||||||
msg += "<li class='tmr-passeur-coord'><a data-actor-id='"+actor.data._id+"' data-tmr-coord='"+coord+"'>"+coord+" - " +caseTMR.label+"</a></li>";
|
msg += "<li class='tmr-passeur-coord'><a data-actor-id='"+actor.data._id+"' data-tmr-coord='"+coord+"'>"+coord+" - " +caseTMR.label+"</a></li>";
|
||||||
}
|
}
|
||||||
|
msg += "</ol>"
|
||||||
|
|
||||||
} else if (rencontre.name == "Briseur de Rêve") {
|
} else if (rencontre.name == "Briseur de Rêve") {
|
||||||
msg += "Ce Briseur des Rêves disparait !"
|
msg += "Ce Briseur des Rêves disparait !"
|
||||||
@ -402,7 +409,7 @@ export class TMRUtility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async processRencontreEchec( actor, rencontre, rolled ) {
|
static async processRencontreEchec( actor, rencontre, rolled, tmrDialog ) {
|
||||||
let msg = "<br>";
|
let msg = "<br>";
|
||||||
|
|
||||||
if (rencontre.name == "Messagers des Rêves") {
|
if (rencontre.name == "Messagers des Rêves") {
|
||||||
@ -419,9 +426,13 @@ export class TMRUtility {
|
|||||||
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;
|
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") {
|
} else if (rencontre.name == "Changeur de Rêve") {
|
||||||
let coordTMR = actor.data.data.reve.tmrpos.coord;
|
msg += "Ce Changeur des Rêves vous déplace sur un autre case du même type.<br>"
|
||||||
let newcoordTMR = this.getRandomLocationType(coordTMR);
|
let locList = this.getLocationTypeList( actor.data.data.reve.tmrpos.coord );
|
||||||
msg += "Vous avez été téléporté en " + coordTMR + " - " + coordTMR.label;
|
let index = new Roll("1d"+locList.length + " - 1").roll().total;
|
||||||
|
let newCoord = locList[index];
|
||||||
|
tmrDialog.forceDemiRevePosition(newCoord);
|
||||||
|
let cellDescr = TMRUtility.getTMRDescription(newCoord);
|
||||||
|
msg += "Vous avez été téléporté en " + newCoord + " - " + cellDescr.label;
|
||||||
|
|
||||||
} else if (rencontre.name == "Briseur de Rêve") {
|
} else if (rencontre.name == "Briseur de 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";
|
||||||
|
@ -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.61",
|
"version": "0.9.62",
|
||||||
"minimumCoreVersion": "0.7.5",
|
"minimumCoreVersion": "0.7.5",
|
||||||
"compatibleCoreVersion": "0.7.6",
|
"compatibleCoreVersion": "0.7.6",
|
||||||
"templateVersion": 47,
|
"templateVersion": 47,
|
||||||
|
Loading…
Reference in New Issue
Block a user