Merge branch 'working' into 'master'
Récupération de fatigue See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!19
This commit is contained in:
commit
3d34921072
155
module/actor.js
155
module/actor.js
@ -122,7 +122,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async performRoll(rollData) {
|
||||
let rolled = await RdDResolutionTable.roll(rollData.carac, rollData.finalLevel, true);
|
||||
let rolled = RdDResolutionTable.roll(rollData.carac, rollData.finalLevel);
|
||||
//rolled.isPart = true; // Pour tester le particulières
|
||||
rollData.rolled = rolled; // garder le résultat
|
||||
console.log("performRoll", rollData, rolled)
|
||||
@ -329,58 +329,96 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
async dormir(heures=1) {
|
||||
let message = { title : "Récupération", content :"Vous dormez " + heures + " heure" + (heures > 1 ? "s": "") };
|
||||
this.recupereEndurance(message);
|
||||
for (let i=0; i<heures; i++) {
|
||||
console.log("recuperationReve", this.data.data);
|
||||
/**
|
||||
* TODO: récupérer les segment de fatigue
|
||||
*/
|
||||
this.recuperationReve();
|
||||
}
|
||||
}
|
||||
|
||||
async recuperationReve() {
|
||||
const seuil = this.data.data.reve.seuil.value;
|
||||
const reve = this.getReveActuel();
|
||||
console.log("recuperationReve", this.data.data);
|
||||
let message = { title : "Récupération" }
|
||||
if (reve > seuil) {
|
||||
message.content = "Vous avez déjà récupéré suffisament (seuil " + seuil + ", rêve actuel "+reve+")";
|
||||
}
|
||||
else {
|
||||
let deRecuperation = await RdDDice.deDraconique();
|
||||
console.log("recuperationReve", deRecuperation);
|
||||
if (deRecuperation>=7)
|
||||
{
|
||||
// Rêve de Dragon !
|
||||
message.content = "Vous faites un <strong>Rêve de Dragon</strong> de " + deRecuperation + " Points de rêve";
|
||||
message.content += await this.combattreReveDeDragon(deRecuperation);
|
||||
}
|
||||
else{
|
||||
message.content = "Vous récupérez " + deRecuperation + " Points de rêve";
|
||||
await this.updatePointsDeReve(deRecuperation);
|
||||
}
|
||||
await this.recupererFatigueUneHeure(message);
|
||||
this.recuperationReve(message);
|
||||
}
|
||||
ChatMessage.create( message );
|
||||
}
|
||||
|
||||
async combattreReveDeDragon(force){
|
||||
recupereEndurance(message) {
|
||||
const avant = this.data.data.sante.endurance.value;
|
||||
this.santeIncDec("endurance", this.data.data.sante.endurance.max - avant);
|
||||
const recupere = this.data.data.sante.endurance.value - avant;
|
||||
if (recupere>0) {
|
||||
message.content += "<br>Vous récuperez " + recupere + " points d'endurance";
|
||||
}
|
||||
}
|
||||
|
||||
async recupererFatigueUneHeure(message) {
|
||||
let fatigue = duplicate(this.data.data.sante.fatigue)
|
||||
if (fatigue.value == 0) {
|
||||
message.content += "<br>Vous êtes déjà reposé";
|
||||
return;
|
||||
}
|
||||
const segments = RdDUtility.getSegmentsFatigue(this.data.data.sante.endurance.max);
|
||||
let cumul = 0;
|
||||
console.log("recupererFatigue", segments);
|
||||
|
||||
let i;
|
||||
for (i=0; i <11; i++) {
|
||||
cumul += segments[i];
|
||||
let diff = cumul - fatigue.value ;
|
||||
if (diff >= 0)
|
||||
{
|
||||
const limit2Segments = Math.floor(segments[i] / 2);
|
||||
if (diff > limit2Segments && i > 0) {
|
||||
cumul -= segments[i-1]; // le segment est à moins de la moitié, il est récupéré
|
||||
}
|
||||
cumul -= segments[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
fatigue.value = cumul;
|
||||
await this.update( {"data.sante.fatigue": fatigue } );
|
||||
if (fatigue.value == 0)
|
||||
{
|
||||
message.content += "<br>Vous êtes bien reposé";
|
||||
}
|
||||
}
|
||||
|
||||
recuperationReve(message) {
|
||||
const seuil = this.data.data.reve.seuil.value;
|
||||
const reve = this.getReveActuel();
|
||||
if (reve >= seuil) {
|
||||
message.content += "<br>Vous avez suffisament rêvé (seuil " + seuil + ", rêve actuel "+reve+")";
|
||||
}
|
||||
else {
|
||||
let deRecuperation = RdDDice.deDraconique();
|
||||
console.log("recuperationReve", deRecuperation);
|
||||
if (deRecuperation>=7)
|
||||
{
|
||||
// Rêve de Dragon !
|
||||
message.content += "<br>Vous faites un <strong>Rêve de Dragon</strong> de " + deRecuperation + " Points de rêve";
|
||||
message.content += this.combattreReveDeDragon(deRecuperation);
|
||||
}
|
||||
else{
|
||||
message.content += "<br>Vous récupérez " + deRecuperation + " Points de rêve";
|
||||
this.updatePointsDeReve(deRecuperation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
combattreReveDeDragon(force){
|
||||
let draconic = this.getBestDraconic();
|
||||
let niveau = Math.max(0, draconic.data.niveau);
|
||||
let etat = this.data.data.compteurs.etat.value;
|
||||
let difficulte = niveau - etat - force;
|
||||
let reveActuel = this.getReveActuel();
|
||||
let roll = await RdDResolutionTable.roll(reveActuel, difficulte);
|
||||
let message = ""
|
||||
const resultatRdD = await this.appliquerReveDeDragon(roll, force);
|
||||
return resultatRdD;
|
||||
let rolled = RdDResolutionTable.roll(reveActuel, difficulte);
|
||||
// TODO: xp particulière
|
||||
consome.log("combattreReveDeDragon", rolled );
|
||||
return this.appliquerReveDeDragon(rolled, force);
|
||||
}
|
||||
|
||||
async appliquerReveDeDragon(roll, force) {
|
||||
appliquerReveDeDragon(roll, force) {
|
||||
let message = "";
|
||||
if (roll.isSuccess) {
|
||||
message += "<br>Vous gagnez " + force + " points de Rêve";
|
||||
this.updatePointDeSeuil();
|
||||
await this.updatePointsDeReve(force);
|
||||
this.updatePointsDeReve(force);
|
||||
}
|
||||
if (roll.isPart) {
|
||||
// TODO: Dialog pour choix entre HR opu général?
|
||||
@ -716,9 +754,9 @@ export class RdDActor extends Actor {
|
||||
if ( data.value < 0 ) data.value = 0;
|
||||
|
||||
if (name == "endurance" && this.data.type != 'entite' ) {
|
||||
if ( sante.fatigue && inc < 0 ) // Each endurance lost -> fatigue lost
|
||||
if ( sante.fatigue && inc < 0 ) { // Each endurance lost -> fatigue lost
|
||||
sante.fatigue.value = sante.fatigue.value - inc
|
||||
|
||||
}
|
||||
// If endurance is 0 -> -1 vie
|
||||
if ( data.value == 0 && sante.vie.value > 0) {
|
||||
sante.vie.value = sante.vie.value - 1;
|
||||
@ -732,7 +770,7 @@ export class RdDActor extends Actor {
|
||||
let blessures = this.data.data.blessures;
|
||||
let nbGraves = this.GetNumberBlessures(blessures.graves.liste);
|
||||
let nbCritiques = this.GetNumberBlessures(blessures.critiques.liste);
|
||||
let maxEnd = Math.floor( data.max / nbGraves);
|
||||
let maxEnd = Math.floor( data.max / (2*nbGraves));
|
||||
if (data.value > maxEnd ) data.value = maxEnd;
|
||||
if ( nbCritiques > 0 && data.value > 1) data.value = 1;
|
||||
|
||||
@ -829,9 +867,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async stressTest() {
|
||||
let target = RdDResolutionTable.computeChances(this.data.data.carac.reve.value, 0);
|
||||
let stressRoll = this._stressRoll(target);
|
||||
|
||||
let stressRoll = this._stressRoll();
|
||||
let compteurs = duplicate(this.data.data.compteurs);
|
||||
let convertion = Math.floor(compteurs.stress.value * stressRoll.factor);
|
||||
|
||||
@ -839,28 +875,33 @@ export class RdDActor extends Actor {
|
||||
compteurs.stress.value = Math.max(compteurs.stress.value - convertion - 1, 0);
|
||||
|
||||
ChatMessage.create({
|
||||
title: "Jet de Stress", content: "Vous avez transformé " + convertion + " points de Stress en Expérience avec une réussite " + stressRoll.comment,
|
||||
title: "Jet de Stress", content: "Vous avez transformé " + convertion + " points de Stress en Expérience" + stressRoll.comment,
|
||||
whisper: ChatMessage.getWhisperRecipients(game.user.name)
|
||||
});
|
||||
await this.update({ "data.compteurs": compteurs });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _stressRoll(target) {
|
||||
let result = await RdDResolutionTable.rollChances(target)
|
||||
switch (result.quality) {
|
||||
case "sign": return { factor: 0.75, comment: "Significative (75%) - " + result.roll }
|
||||
case "norm": return { factor: 0.5, comment: "Normale (50%) - " + result.roll }
|
||||
case "echec": return { factor: 0.2, comment: "Echec (20%) - " + result.roll }
|
||||
case "epart": return { factor: 0.1, comment: "Echec particulier(10%) - " + result.roll }
|
||||
case "etotal": return { factor: 0, comment: "Echec Total (0%) - " + result.roll }
|
||||
}
|
||||
let second = await RdDResolutionTable.rollChances(target)
|
||||
switch (second.quality) {
|
||||
_stressRoll() {
|
||||
let result = RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
|
||||
console.log("_stressRoll", result);
|
||||
switch (result.code) {
|
||||
case "sign": return { factor: 0.75, comment: " (75%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
|
||||
case "norm": return { factor: 0.5, comment: " (50%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
|
||||
case "echec": return { factor: 0.2, comment: " (20%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
|
||||
case "epart": return { factor: 0.1, comment: " (10%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
|
||||
case "etotal": return { factor: 0, comment: " (0%): " + result.quality + " - " + result.roll + " sur " + result.score + "%" }
|
||||
case "part":
|
||||
{
|
||||
let second = RdDResolutionTable.roll(this.data.data.carac.reve.value, 0);
|
||||
console.log("_stressRoll", second);
|
||||
switch (second.code) {
|
||||
case "part": case "sign":
|
||||
return { factor: 1.5, comment: "Double Particulière (150%) - " + result.roll + " puis " + second.roll }
|
||||
return { factor: 1.5, comment: " (150%): Double Particulière - " + result.roll + " puis " + second.roll + " sur " + result.score + "%" }
|
||||
default:
|
||||
return { factor: 1, comment: "Particulière (100%) - " + result.roll + " puis " + second.roll }
|
||||
return { factor: 1, comment: " (150%): " + result.quality + " - " + result.roll + " puis " + second.roll + " sur " + result.score + "%" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,16 @@
|
||||
export class RdDDice {
|
||||
|
||||
static async deDraconique() {
|
||||
static deDraconique(rollMode="selfroll") {
|
||||
let roll = new Roll("1d8x8").evaluate();
|
||||
await this.show(roll);
|
||||
this.show(roll, rollMode);
|
||||
return roll.total - Math.ceil(roll.total / 8);
|
||||
}
|
||||
|
||||
static async show(roll, rollMode = "roll") {
|
||||
await this.showDiceSoNice(roll, rollMode);
|
||||
|
||||
static show(roll, rollMode = "roll") {
|
||||
if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
|
||||
this.showDiceSoNice(roll, rollMode);
|
||||
}
|
||||
return roll;
|
||||
}
|
||||
|
||||
|
@ -103,11 +103,19 @@ Hooks.once("init", async function() {
|
||||
rollDataHandler: {}
|
||||
}
|
||||
// Create specific settings
|
||||
game.settings.register("foundryvtt-reve-de-dragon", "configuration", {
|
||||
name: "configuration",
|
||||
scope: "world",
|
||||
config: false,
|
||||
type: Object
|
||||
// game.settings.register("foundryvtt-reve-de-dragon", "configuration", {
|
||||
// name: "configuration",
|
||||
// scope: "world",
|
||||
// config: false,
|
||||
// type: Object
|
||||
// });
|
||||
game.settings.register("foundryvtt-reve-de-dragon", "dice-so-nice", {
|
||||
name: "Montrer les dés pour toutes les jets",
|
||||
hint: "Utilise Dice So Nice pour tous les jets de dés possibles. Décocher pour limiter à la table de résolution",
|
||||
scope: "client",
|
||||
config: true,
|
||||
default: false,
|
||||
type: Boolean
|
||||
});
|
||||
//game.settings.get("<systemName>","<settingName>") to retrieve it and game.settings.set("<systemName>","<settingName>", <newValue>)
|
||||
|
||||
@ -167,8 +175,12 @@ Hooks.once("init", async function() {
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
Hooks.once("ready", function() {
|
||||
ChatMessage.create( { title: "Bienvenu dans le Rêve !", content : "Bienvenu dans le Rêve des Dragons !<br> " +
|
||||
"Vous trouverez quelques infos pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}" } );
|
||||
ChatMessage.create( {
|
||||
whisper: [game.user],
|
||||
title: "Bienvenu dans le Rêve !",
|
||||
content : "Bienvenu dans le Rêve des Dragons !<br> " +
|
||||
"Vous trouverez quelques infos pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}" }
|
||||
);
|
||||
|
||||
/* Affiche le calendrier */
|
||||
let calendrier = new RdDCalendrier();
|
||||
|
@ -85,21 +85,20 @@ export class RdDResolutionTable {
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static async roll(carac, finalLevel, showDice=false) {
|
||||
static roll(carac, finalLevel) {
|
||||
let chances = this.computeChances(carac, finalLevel);
|
||||
chances.showDice = showDice;
|
||||
let rolled = await this.rollChances(chances);
|
||||
chances.showDice = true;
|
||||
let rolled = this.rollChances(chances);
|
||||
rolled.carac = carac;
|
||||
rolled.finalLevel = finalLevel;
|
||||
return rolled;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollChances(chances) {
|
||||
static rollChances(chances) {
|
||||
let myRoll = new Roll("d100").roll();
|
||||
if (chances.showDice) {
|
||||
await RdDDice.showDiceSoNice(myRoll);
|
||||
}
|
||||
myRoll.showDice = chances.showDice;
|
||||
RdDDice.show(myRoll);
|
||||
chances.roll = myRoll.total;
|
||||
mergeObject(chances, this._computeReussite(chances, chances.roll));
|
||||
return chances;
|
||||
|
@ -137,9 +137,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
this.currentRencontre = undefined;
|
||||
let rencontre = this.rencontresExistantes.find(prev => prev.coord == coordTMR);
|
||||
let deRencontre = new Roll("d7").roll();
|
||||
console.log("manageRencontre", deRencontre, rencontre);
|
||||
if (rencontre == undefined) {
|
||||
let deRencontre = new Roll("d7").roll();
|
||||
if (deRencontre.total == 7) {
|
||||
rencontre = await TMRUtility.rencontreTMRRoll(coordTMR, cellDescr);
|
||||
}
|
||||
|
@ -27,22 +27,23 @@ const competence_xp_par_niveau = [ 5, 5, 5, 10, 10, 10, 10, 15, 15, 15, 15, 20,
|
||||
const carac_array = [ "taille", "apparence", "constitution", "force", "agilite", "dexterite", "vue", "ouie", "odoratgout", "volonte", "intellect", "empathie", "reve", "chance", "melee", "tir", "lancer", "derobee"];
|
||||
const difficultesLibres = [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10];
|
||||
const ajustementsConditions = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, +1, +2, +3, +4, +5, +6, +7, +8, +9, +10];
|
||||
const fatigueMatrix = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // Dummy filler for the array.
|
||||
[2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3 ],
|
||||
[2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3 ],
|
||||
[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ],
|
||||
[3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4 ],
|
||||
[3, 3, 4, 3, 3, 4, 3, 3, 4, 3, 3, 4 ],
|
||||
[3, 3, 4, 3, 4, 4, 3, 3, 4, 3, 4, 4 ],
|
||||
[3, 4, 4, 3, 4, 4, 3, 4, 4, 3, 4, 4 ],
|
||||
[3, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4 ],
|
||||
[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ],
|
||||
[4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5 ],
|
||||
[4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 5 ],
|
||||
[4, 4, 5, 4, 5, 5, 4, 4, 5, 4, 5, 5 ],
|
||||
[4, 5, 5, 4, 5, 5, 4, 5, 5, 4, 5, 5 ],
|
||||
[4, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5 ],
|
||||
[5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] ];
|
||||
|
||||
function _buildAllSegmentsFatigue(max) {
|
||||
const cycle = [5, 2, 4, 1, 3, 0];
|
||||
let fatigue = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
|
||||
for (let i = 0; i <= 40; i++) {
|
||||
const ligneFatigue= duplicate(fatigue[i]);
|
||||
const caseIncrementee = cycle[i % 6];
|
||||
ligneFatigue[caseIncrementee]++;
|
||||
ligneFatigue[caseIncrementee + 6]++;
|
||||
ligneFatigue.fatigueMax = 2 * (i + 1);
|
||||
fatigue[i + 1] = ligneFatigue ;
|
||||
}
|
||||
return fatigue;
|
||||
}
|
||||
|
||||
const fatigueMatrix = _buildAllSegmentsFatigue(30);
|
||||
|
||||
const fatigueMalus = [ 0, 0, 0, -1, -1, -1, -2, -3, -4, -5, -6, -7 ]; // Provides the malus for each segment of fatigue
|
||||
const fatigueLineSize = [ 3, 6, 7, 8, 9, 10, 11, 12];
|
||||
const fatigueLineMalus = [ 0, -1, -2, -3, -4, -5, -6, -7 ];
|
||||
@ -84,7 +85,6 @@ const definitionsEncaissement = {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async preloadHandlebarsTemplates( ) {
|
||||
const templatePaths = [
|
||||
@ -255,12 +255,12 @@ export class RdDUtility {
|
||||
/* -------------------------------------------- */
|
||||
static computeCarac( data)
|
||||
{
|
||||
let fmax = parseInt(data.carac.taille.value) + 4;
|
||||
if ( data.carac.force.value > fmax )
|
||||
data.carac.force.value = fmax;
|
||||
data.carac.force.value = Math.min(data.carac.force.value, parseInt(data.carac.taille.value) + 4);
|
||||
|
||||
data.carac.derobee.value = Math.floor(parseInt(((21 - data.carac.taille.value)) + parseInt(data.carac.agilite.value)) / 2);
|
||||
let bonusDomKey = Math.floor( (parseInt(data.carac.force.value) + parseInt(data.carac.taille.value)) / 2);
|
||||
|
||||
// TODO: gérer table des bonus dommages (et autres) des créatures
|
||||
data.attributs.plusdom.value = 2
|
||||
if (bonusDomKey < 8)
|
||||
data.attributs.plusdom.value = -1;
|
||||
@ -275,15 +275,12 @@ export class RdDUtility {
|
||||
data.carac.lancer.value = Math.floor( (parseInt(data.carac.tir.value) + parseInt(data.carac.force.value)) / 2);
|
||||
|
||||
data.sante.vie.max = Math.ceil( (parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value)) /2 );
|
||||
if ( data.sante.vie.value > data.sante.vie.max)
|
||||
data.sante.vie.value = data.sante.vie.max;
|
||||
let endurance = Math.max( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value) );
|
||||
data.sante.endurance.max = endurance;
|
||||
if ( data.sante.endurance.value > endurance)
|
||||
data.sante.endurance.value = endurance;
|
||||
data.sante.fatigue.max = endurance*2;
|
||||
if ( data.sante.fatigue.value > data.sante.fatigue.max )
|
||||
data.sante.fatigue.value = data.sante.fatigue.max;
|
||||
|
||||
data.sante.vie.value = Math.min(data.sante.vie.value, data.sante.vie.max)
|
||||
data.sante.endurance.max = Math.max( parseInt(data.carac.taille.value) + parseInt(data.carac.constitution.value), parseInt(data.sante.vie.max) + parseInt(data.carac.volonte.value) );
|
||||
data.sante.endurance.value = Math.min(data.sante.endurance.value, data.sante.endurance.max);
|
||||
data.sante.fatigue.max = data.sante.endurance.max*2;
|
||||
data.sante.fatigue.value = Math.min(data.sante.fatigue.value, data.sante.fatigue.max);
|
||||
|
||||
data.attributs.sconst.value = 5; // Max !
|
||||
if ( data.carac.constitution.value < 9 )
|
||||
@ -306,17 +303,31 @@ export class RdDUtility {
|
||||
data.compteurs.chance.max = data.carac.chance.value;
|
||||
}
|
||||
|
||||
static getSegmentsFatigue(endurance) {
|
||||
endurance = Math.max(endurance, 1);
|
||||
endurance = Math.min(endurance, fatigueMatrix.length);
|
||||
return fatigueMatrix[endurance];
|
||||
}
|
||||
|
||||
static cumulSegments(segments) {
|
||||
let cumuls = [segments[0]];
|
||||
for (let i = 1; i < 12; i++) {
|
||||
cumuls[i] = segments[i] + cumuls[i - 1];
|
||||
}
|
||||
return cumuls;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Build the nice (?) html table used to manage fatigue.
|
||||
// max should Mbe the endurance max value
|
||||
static makeHTMLfatigueMatrix( value, max )
|
||||
{
|
||||
max = (max < 16) ? 16 : max;
|
||||
max = (max > 30) ? 30 : max;
|
||||
value = (value > max*2) ? max*2 : value;
|
||||
value = (value < 0) ? 0 : value;
|
||||
// max should be the endurance max value
|
||||
static makeHTMLfatigueMatrix( fatigue, maxEndurance) {
|
||||
let segments = this.getSegmentsFatigue(maxEndurance);
|
||||
return this.makeHTMLfatigueMatrixForSegment(fatigue, segments);
|
||||
}
|
||||
|
||||
let fatigueTab = fatigueMatrix[max];
|
||||
static makeHTMLfatigueMatrixForSegment(fatigue, segments) {
|
||||
fatigue = Math.max(fatigue, 0);
|
||||
fatigue = Math.min(fatigue, segments.fatigueMax);
|
||||
|
||||
let table = $("<table/>").addClass('table-fatigue');
|
||||
let segmentIdx = 0;
|
||||
@ -326,11 +337,13 @@ export class RdDUtility {
|
||||
let segmentsPerLine = fatigueLineSize[line];
|
||||
row.append("<td class='fatigue-malus'>" + fatigueLineMalus[line] + "</td>");
|
||||
while (segmentIdx < segmentsPerLine) {
|
||||
let freeSize = fatigueTab[segmentIdx];
|
||||
let freeSize = segments[segmentIdx];
|
||||
for (let col = 0; col < 5; col++) {
|
||||
if (col < freeSize) {
|
||||
if (fatigueCount < value )
|
||||
if (fatigueCount < fatigue)
|
||||
row.append("<td class='fatigue-used'/>");
|
||||
|
||||
|
||||
else
|
||||
row.append("<td class='fatigue-free'/>");
|
||||
fatigueCount++;
|
||||
@ -343,7 +356,6 @@ export class RdDUtility {
|
||||
}
|
||||
table.append(row);
|
||||
}
|
||||
//console.log("fatigue", table);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ export class TMRUtility {
|
||||
let rencontre = this.rencontreTMRTypeCase(cellDescr.type);
|
||||
if (rencontre){
|
||||
rencontre = duplicate(rencontre);
|
||||
rencontre.force = await this.evaluerForceRencontre(rencontre);
|
||||
rencontre.force = this.evaluerForceRencontre(rencontre);
|
||||
rencontre.coord = coordTMR;
|
||||
}
|
||||
return rencontre;
|
||||
@ -280,13 +280,15 @@ export class TMRUtility {
|
||||
static rencontreTMRTypeCase(typeTMR, roll=undefined) {
|
||||
if (!roll)
|
||||
{
|
||||
roll = new Roll("d100").roll().total;
|
||||
roll = RdDDice.show(new Roll("d100").evaluate()).total;
|
||||
console.log("rencontreTMRTypeCase", roll);
|
||||
}
|
||||
typeTMR = typeTMR.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
for( let rencontre of rencontresTable) {
|
||||
let scoreDef = rencontre.data[typeTMR];
|
||||
let min = scoreDef.substr(0,2);
|
||||
let max = scoreDef.substr(3,2);
|
||||
if (min=="00") min = 101;
|
||||
if (max=="00") max = 100;
|
||||
if (roll >= min && roll <= max) {
|
||||
return rencontre;
|
||||
@ -300,7 +302,7 @@ export class TMRUtility {
|
||||
* @param {*} caseName
|
||||
* @param {*} roll
|
||||
*/
|
||||
static async getRencontre( caseName, roll ) {
|
||||
static getRencontre( caseName, roll ) {
|
||||
if (!roll) {
|
||||
roll = new Roll("1d100").roll().total;
|
||||
}
|
||||
@ -311,7 +313,7 @@ export class TMRUtility {
|
||||
|
||||
let rencontre = this.rencontreTMRTypeCase(caseName, roll);
|
||||
if (rencontre) {
|
||||
let force = await this.evaluerForceRencontre(rencontre);
|
||||
let force = this.evaluerForceRencontre(rencontre);
|
||||
ChatMessage.create({ content: "Rencontre en " + caseName + "(jet : " + roll + "%)<br>Vous rencontrez un " + rencontre.name + " d'une force de " + force + " Points de Rêve" });
|
||||
}
|
||||
return false;
|
||||
@ -323,9 +325,9 @@ export class TMRUtility {
|
||||
// TODO random get same type
|
||||
}
|
||||
|
||||
static async evaluerForceRencontre(rencontre) {
|
||||
static evaluerForceRencontre(rencontre) {
|
||||
if (this.isReveDeDragon(rencontre)) {
|
||||
let ddr = await RdDDice.deDraconique();
|
||||
let ddr = RdDDice.deDraconique();
|
||||
return ddr + 7;
|
||||
}
|
||||
else {
|
||||
@ -371,6 +373,7 @@ export class TMRUtility {
|
||||
msg += "Ce Tourbillon Noir disparait !"
|
||||
|
||||
} else if (rencontre.name == "Rêve de Dragon") {
|
||||
// TODO: xp particulière
|
||||
msg += "Vous maîtrisez le Rêve de Dragon !"
|
||||
msg += actor.appliquerReveDeDragon(rolled, rencontre.force);
|
||||
}
|
||||
|
@ -278,10 +278,13 @@
|
||||
|
||||
{{!-- Compteurs/Blessures Tab --}}
|
||||
<div class="tab blessurescompteurs" data-group="primary" data-tab="blessurescompteurs">
|
||||
<div class="flex-group-left flexrow">
|
||||
<span class="dormir-une-heure"><a><img src="icons/svg/sleep.svg" alt="Dormir une heure" width="50" height="50"/></a></span>
|
||||
</div>
|
||||
<div class="flex-group-left flexrow">
|
||||
<ol class="item-list">
|
||||
{{#each data.compteurs as |compteur key|}}
|
||||
<li class="item flexrow"">
|
||||
<li class="item flexrow">
|
||||
<span class="arme-label">{{compteur.label}}</span>
|
||||
{{#if compteur.isInput}}
|
||||
<input class="stress-value stress-style compteur-edit" id="{{key}}-edit" type="text" name="{{key}}" value="{{compteur.value}}" data-dtype="number"/>
|
||||
@ -385,41 +388,51 @@
|
||||
|
||||
{{!-- hautreve Tab --}}
|
||||
<div class="tab hautreve" data-group="primary" data-tab="hautreve" style="height:200px">
|
||||
<div>
|
||||
<span class="visu-tmr"><strong><a>Regarder les Terres Medianes</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="monte-tmr"><strong><a>Monter Normale dans les Terres Medianes !</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="monte-tmr-rapide"><strong><a>Monter en Accéléré dans les Terres Medianes !</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="dormir-une-heure"><strong><a>Dormir une heure</a></strong></span>
|
||||
</div>
|
||||
<div>
|
||||
<ol class="item-list">
|
||||
<li class="item flexrow">
|
||||
<span class="ptreve-actuel"><a>Points de Rêve actuels</a> :</span>
|
||||
<span class="competence-label">Position en TMR :</span>
|
||||
<span>
|
||||
{{#if data.isGM}}
|
||||
<input class="competence-value" type="text" name="data.reve.tmrpos.coord" value="{{data.reve.tmrpos.coord}}" data-dtype="String"/>
|
||||
{{else}}
|
||||
{{data.reve.tmrpos.coord}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
<li class="item flexrow" >
|
||||
<span class="competence-label"></span>
|
||||
<div>
|
||||
<span class="monte-tmr"><a><img src="icons/svg/up.svg" alt="Montée normale dans les Terres Medianes !" width="50" height="50"/></a></span>
|
||||
<span class="monte-tmr-rapide"><a><img src="icons/svg/thrust.svg" alt="Montée accélérée dans les Terres Medianes !" width="50" height="50"/></a></span>
|
||||
<span class="visu-tmr"><a><img src="icons/svg/eye.svg" alt="Regarder les Terres Medianes" width="50" height="50"/></a></span>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<span class="ptreve-actuel competence-label"><a>Points de Rêve actuels</a> :</span>
|
||||
<span><input class="pointsreve-value" type="text" name="data.reve.reve.value" value="{{data.reve.reve.value}}" data-dtype="Number"/></span>
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<span class="seuil-reve"><a>Seuil de Rêve</a> :</span>
|
||||
<span><input class="seuil-reve-value" type="text" name="data.reve.seuil.value" value="{{data.reve.seuil.value}}" data-dtype="Number"/></span>
|
||||
</li>
|
||||
<span class="competence-label">Seuil de Rêve :</span>
|
||||
<span>
|
||||
{{#if data.isGM}}
|
||||
<li class="item flexrow">
|
||||
<span class="competence-label">Position en TMR : </span>
|
||||
<span><input class="competence-value" type="text" name="data.reve.tmrpos.coord" value="{{data.reve.tmrpos.coord}}" data-dtype="String"/></span>
|
||||
<input class="seuil-reve-value" type="text" name="data.reve.seuil.value" value="{{data.reve.seuil.value}}" data-dtype="Number"/>
|
||||
{{else}}
|
||||
{{data.reve.seuil.value}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
<li class="item flexrow" >
|
||||
<span class="competence-label">Refoulement : </span>
|
||||
<span><input class="competence-value" type="text" name="data.reve.refoulement.value" value="{{data.reve.refoulement.value}}" data-dtype="Number"/></span>
|
||||
</li>
|
||||
<span>
|
||||
{{#if data.isGM}}
|
||||
<input class="competence-value" type="text" name="data.reve.refoulement.value" value="{{data.reve.refoulement.value}}" data-dtype="Number"/>
|
||||
{{else}}
|
||||
<li class="item flexrow" >Position en TMR : {{data.reve.tmrpos.coord}} </li>
|
||||
<li class="item flexrow" >Refoulement : {{data.reve.refoulement.value}} </li>
|
||||
{{data.reve.refoulement.value}}
|
||||
{{/if}}
|
||||
</span>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<div>
|
||||
|
Loading…
Reference in New Issue
Block a user