Compare commits

..

No commits in common. "eb097145794e6a68d735957a19753147f623722f" and "b5dc14687e3796a77d30d432d9465c10062b8196" have entirely different histories.

9 changed files with 40 additions and 49 deletions

View File

@ -1,9 +1,4 @@
# 11.2 # 11.2
## 11.2.8 - L'éclairage d'Akarlikarlikar
- l'ajustement de la lumière jour/nuit s'étale sur moins de temps (vaisseau et Lyre)
- les nouveaux tooltips ne masquent plus l'information d'expérience
- les jets de dés pour maîtriser les rencontres fonctionnent de nouveau
## 11.2.7 - Les explications d'Akarlikarlikar ## 11.2.7 - Les explications d'Akarlikarlikar
- Ajout de tooltips sur la plupart des boutons, liens clickables, objets, tâches, ... - Ajout de tooltips sur la plupart des boutons, liens clickables, objets, tâches, ...
- Fix: on peut de nouveau regarder l'inventaire avec les droits limités/observateur - Fix: on peut de nouveau regarder l'inventaire avec les droits limités/observateur

View File

@ -23,10 +23,6 @@ export class Misc {
return isPositiveNumber ? "+" + number : number return isPositiveNumber ? "+" + number : number
} }
static modulo(n, m) {
return ((n % m) + m) % m;
}
static sum() { static sum() {
return (a, b) => Number(a) + Number(b); return (a, b) => Number(a) + Number(b);
} }

View File

@ -515,7 +515,7 @@ export class RdDCombat {
static _callJetDeVie(event) { static _callJetDeVie(event) {
let actorId = event.currentTarget.attributes['data-actorId'].value; let actorId = event.currentTarget.attributes['data-actorId'].value;
let tokenId = event.currentTarget.attributes['data-tokenId'].value; let tokenId = event.currentTarget.attributes['data-tokenId'].value;
let token = canvas.tokens.get(tokenId) let token = canvas.tokens.placeables.find(t => t.id == tokenId)
const actor = token?.actor ?? game.actors.get(actorId); const actor = token?.actor ?? game.actors.get(actorId);
if (actor?.isOwner) { if (actor?.isOwner) {
actor.jetDeVie(); actor.jetDeVie();

View File

@ -64,19 +64,19 @@ export const referenceAjustements = {
}, },
encTotal: { encTotal: {
isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence), isVisible: (rollData, actor) => RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence),
isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use?.encTotal, isUsed: (rollData, actor) => !rollData.oeuvre && RdDCarac.isAgiliteOuDerobee(rollData.selectedCarac) && RdDItemCompetence.isMalusEncombrementTotal(rollData.competence) && rollData.use.encTotal,
getLabel: (rollData, actor) => 'Encombrement total', getLabel: (rollData, actor) => 'Encombrement total',
getValue: (rollData, actor) => -actor.getEncTotal() getValue: (rollData, actor) => -actor.getEncTotal()
}, },
surenc: { surenc: {
isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac) && actor.isSurenc(), isVisible: (rollData, actor) => RdDCarac.isActionPhysique(rollData.selectedCarac) && actor.isSurenc(),
isUsed: (rollData, actor) => rollData.use.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac), isUsed: (rollData, actor) => rollData.use?.surenc && RdDCarac.isActionPhysique(rollData.selectedCarac),
getLabel: (rollData, actor) => 'Sur-encombrement', getLabel: (rollData, actor) => 'Sur-encombrement',
getValue: (rollData, actor) => actor.computeMalusSurEncombrement() getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
}, },
moral: { moral: {
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral, isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.selectedCarac) && rollData.use?.moral,
isUsed: (rollData, actor) => rollData.use.moral, isUsed: (rollData, actor) => rollData.use?.moral,
getLabel: (rollData, actor) => 'Appel au moral', getLabel: (rollData, actor) => 'Appel au moral',
getValue: (rollData, actor) => 1 getValue: (rollData, actor) => 1
}, },
@ -84,7 +84,7 @@ export const referenceAjustements = {
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac), isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac),
isUsed: (rollData, actor) => rollData.use.coeur != undefined, isUsed: (rollData, actor) => rollData.use.coeur != undefined,
getLabel: (rollData, actor) => 'Ajustement de cœur', getLabel: (rollData, actor) => 'Ajustement de cœur',
getValue: (rollData, actor) => -2 * (rollData.use?.coeur?.coeur ?? 0) getValue: (rollData, actor) => -2 * (rollData.use.coeur?.coeur ?? 0)
}, },
moralTotal: { moralTotal: {
isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac), isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac),
@ -141,7 +141,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => "Force de l'alcool: ", getLabel: (rollData, actor) => "Force de l'alcool: ",
getValue: (rollData, actor) => rollData.forceAlcool, getValue: (rollData, actor) => rollData.forceAlcool,
}, },
ethylisme: { ethylisme:{
isVisible: (rollData, actor) => rollData.ethylisme != undefined, isVisible: (rollData, actor) => rollData.ethylisme != undefined,
isUsed: (rollData, actor) => rollData.ethylisme != undefined, isUsed: (rollData, actor) => rollData.ethylisme != undefined,
getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme), getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme),
@ -159,9 +159,7 @@ export class RollDataAjustements {
/* -------------------------------------------- */ /* -------------------------------------------- */
static calcul(rollData, actor) { static calcul(rollData, actor) {
// s'assurer de la correction des infos rollData rollData.ajustements = {};
mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
for (var key in referenceAjustements) { for (var key in referenceAjustements) {
const reference = referenceAjustements[key]; const reference = referenceAjustements[key];
rollData.ajustements[key] = { rollData.ajustements[key] = {

View File

@ -2,6 +2,7 @@ import { SHOW_DICE, SYSTEM_RDD } from "../constants.js";
import { Grammar } from "../grammar.js"; import { Grammar } from "../grammar.js";
import { Misc } from "../misc.js"; import { Misc } from "../misc.js";
import { RdDDice } from "../rdd-dice.js"; import { RdDDice } from "../rdd-dice.js";
import { AutoAdjustDarkness } from "./auto-adjust-darkness.js";
export const WORLD_TIMESTAMP_SETTING = "calendrier"; export const WORLD_TIMESTAMP_SETTING = "calendrier";
@ -15,14 +16,14 @@ export const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PA
const ROUNDS_PAR_MINUTE = 10; const ROUNDS_PAR_MINUTE = 10;
const DEFINITION_HEURES = [ const DEFINITION_HEURES = [
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps", darkness: 0.9 }, { key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps" , darkness: 0.7},
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps", darkness: 0.1 }, { key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps" , darkness: 0.4},
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps", darkness: 0 }, { key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps" , darkness: 0},
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté", darkness: 0 }, { key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté" , darkness: 0},
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 }, { key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 },
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0 }, { key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0},
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.1 }, { key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.4 },
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.9 }, { key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.7 },
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 }, { key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 },
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 }, { key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 },
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 }, { key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 },
@ -97,10 +98,10 @@ export class RdDTimestamp {
*/ */
static definition(signe) { static definition(signe) {
if (signe == undefined) { if (signe == undefined) {
signe = 0 signe = 0;
} }
if (Number.isInteger(signe)) { if (Number.isInteger(signe)) {
return DEFINITION_HEURES[Misc.modulo(signe, RDD_HEURES_PAR_JOUR)] return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR];
} }
let definition = DEFINITION_HEURES.find(it => it.key == signe); let definition = DEFINITION_HEURES.find(it => it.key == signe);
if (!definition) { if (!definition) {
@ -118,7 +119,10 @@ export class RdDTimestamp {
} }
static ajustementAstrologiqueHeure(hn, nbAstral, heure) { static ajustementAstrologiqueHeure(hn, nbAstral, heure) {
let ecart = Misc.modulo(hn + nbAstral - heure, RDD_HEURES_PAR_JOUR); let ecart = (hn + nbAstral - heure) % RDD_HEURES_PAR_JOUR;
if (ecart < 0) {
ecart = (ecart + RDD_HEURES_PAR_JOUR) % RDD_HEURES_PAR_JOUR;
}
switch (ecart) { switch (ecart) {
case 0: return 4; case 0: return 4;
case 4: case 8: return 2; case 4: case 8: return 2;
@ -154,13 +158,11 @@ export class RdDTimestamp {
} }
static defHeure(heure) { static defHeure(heure) {
heure = Misc.modulo(heure, RDD_HEURES_PAR_JOUR); return DEFINITION_HEURES.find(it => (it.heure) == heure % RDD_HEURES_PAR_JOUR);
return DEFINITION_HEURES.find(it => it.heure == heure)
} }
static findHeure(heure) { static findHeure(heure) {
heure = Grammar.toLowerCaseNoAccentNoSpace(heure); heure = Grammar.toLowerCaseNoAccentNoSpace(heure);
let parHeureOuLabel = DEFINITION_HEURES.filter(it => Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure || it.heure == Misc.modulo(parseInt(heure), RDD_HEURES_PAR_JOUR)); let parHeureOuLabel = DEFINITION_HEURES.filter(it => (it.heure) == parseInt(heure) % RDD_HEURES_PAR_JOUR || Grammar.toLowerCaseNoAccentNoSpace(it.label) == heure);
if (parHeureOuLabel.length == 1) { if (parHeureOuLabel.length == 1) {
return parHeureOuLabel[0]; return parHeureOuLabel[0];
} }
@ -230,19 +232,19 @@ export class RdDTimestamp {
} }
get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) } get annee() { return Math.floor(this.indexDate / RDD_JOURS_PAR_AN) }
get mois() { return Math.floor(Misc.modulo(this.indexDate, RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) } get mois() { return Math.floor((this.indexDate % RDD_JOURS_PAR_AN) / RDD_JOURS_PAR_MOIS) }
get jour() { return Misc.modulo(Misc.modulo(this.indexDate, RDD_JOURS_PAR_AN), RDD_JOURS_PAR_MOIS) } get jour() { return (this.indexDate % RDD_JOURS_PAR_AN) % RDD_JOURS_PAR_MOIS }
get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) } get heure() { return Math.floor(this.indexMinute / RDD_MINUTES_PAR_HEURES) }
get minute() { return Misc.modulo(this.indexMinute, RDD_MINUTES_PAR_HEURES) } get minute() { return this.indexMinute % RDD_MINUTES_PAR_HEURES }
get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) } get round() { return ROUNDS_PAR_MINUTE * (this.indexMinute - Math.floor(this.indexMinute)) }
get angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 } get angleHeure() { return this.indexMinute / RDD_MINUTES_PAR_JOUR * 360 - 45 }
get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45 } get angleMinute() { return this.indexMinute / RDD_MINUTES_PAR_HEURES * 360 + 45 }
get darkness() { get darkness() {
const darknessDebut = 100 * RdDTimestamp.definition(this.heure).darkness const darknessDebut = RdDTimestamp.definition(this.heure).darkness *100
const darknessFin = 100 * RdDTimestamp.definition(this.heure + 1).darkness const darknessFin = RdDTimestamp.definition(this.heure + 1).darkness *100
const darknessMinute = Math.round((darknessFin - darknessDebut) * this.minute / RDD_MINUTES_PAR_HEURES); const darknessMinute = Math.round((darknessFin - darknessDebut) * this.minute / RDD_MINUTES_PAR_HEURES);
return (darknessDebut + darknessMinute) / 100 return (darknessDebut + darknessMinute)/100
} }
/** /**
@ -295,7 +297,7 @@ export class RdDTimestamp {
const heure = this.heure + heures; const heure = this.heure + heures;
return new RdDTimestamp({ return new RdDTimestamp({
indexDate: this.indexDate + Math.floor(heure / RDD_HEURES_PAR_JOUR), indexDate: this.indexDate + Math.floor(heure / RDD_HEURES_PAR_JOUR),
indexMinute: this.indexMinute + Misc.modulo(heure, RDD_HEURES_PAR_JOUR) * RDD_MINUTES_PAR_HEURES indexMinute: this.indexMinute + (heure % RDD_HEURES_PAR_JOUR) * RDD_MINUTES_PAR_HEURES
}) })
} }
@ -345,7 +347,7 @@ export class RdDTimestamp {
return { return {
jours: jours, jours: jours,
heures: Math.floor(minutes / RDD_MINUTES_PAR_HEURES), heures: Math.floor(minutes / RDD_MINUTES_PAR_HEURES),
minutes: Misc.modulo(minutes, RDD_MINUTES_PAR_HEURES) minutes: minutes % RDD_MINUTES_PAR_HEURES
} }
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "11.2.8", "version": "11.2.7",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.8.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.7.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": { "compatibility": {

View File

@ -1,13 +1,13 @@
{{#unless system.isHidden}} {{#unless system.isHidden}}
<li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}"> <li class="item flexrow list-item {{#if system.isLevelUp}}xp-level-up tooltip{{/if}}" data-item-id="{{_id}}" data-tooltip="Niveau {{plusMoins system.niveau}} en {{name}}">
<a class="competence-label" name="{{name}}" data-tooltip="Niveau {{plusMoins system.niveau}} en {{name}}"> <a class="competence-label" name="{{name}}">
<img class="sheet-competence-img" src="{{img}}"/> <img class="sheet-competence-img" src="{{img}}"/>
<span>{{name}}</span> <span>{{name}}</span>
</a> </a>
{{#if system.isLevelUp}} {{#if system.isLevelUp}}
<span class="tooltiptext ttt-levelup">Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext ttt-levelup">Vous pouvez dépenser {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
<a class="competence-xp-augmenter" compname="{{name}}"> <a class="competence-xp-augmenter" compname="{{name}}" data-tooltip="Augmenter d'un niveau en {{name}}">
<i class="fas fa-arrow-alt-circle-up"></i> <i class="fas fa-arrow-alt-circle-up"></i>
</a> </a>
{{/if}} {{/if}}
@ -19,7 +19,7 @@
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<span class="competence-xp {{#unless system.isLevelUp}}tooltip{{/unless}}"> <span class="competence-xp {{#unless system.isLevelUp}}tooltip{{/unless}}">
<input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}" <input class="competence-xp " type="text" compname="{{name}}" name="comp-xp-{{name}}"
value="{{numberFormat system.xp decimals=0 sign=false}}" data-dtype="number" value="{{numberFormat system.xp decimals=0 sign=false}}" data-dtype="number" data-tooltip="Expérience {{system.xp}} en {{name}}"
{{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} /> {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} />
{{#unless system.isLevelUp}} {{#unless system.isLevelUp}}
<span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span> <span class="tooltiptext left-competence ttt-xp">Vous devez acquérir {{system.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
@ -28,7 +28,7 @@
{{/if}} {{/if}}
{{#if (eq system.categorie 'draconic')}} {{#if (eq system.categorie 'draconic')}}
<input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}" <input class="competence-xp-sort" type="text" compname="{{name}}" name="comp-xp-sort-{{name}}"
value="{{numberFormat system.xp_sort decimals=0 sign=false}}" data-dtype="number" value="{{numberFormat system.xp_sort decimals=0 sign=false}}" data-dtype="number" data-tooltip="Expérience {{system.xp_sort}} en sorts de {{name}}"
{{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} /> {{#if (or (not @root.options.vueDetaillee) @root.options.vueArchetype)}}disabled{{/if}} />
{{/if}} {{/if}}
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}

View File

@ -9,7 +9,7 @@
{{#if item.descr}} {{#if item.descr}}
{{{item.descr}}} {{{item.descr}}}
{{else}} {{else}}
{{{item.label}}}: {{plusMoins item.value}} {{item.label}}: {{plusMoins item.value}}
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}

View File

@ -9,7 +9,7 @@
{{#if item.descr}} {{#if item.descr}}
{{{item.descr}}} {{{item.descr}}}
{{else}} {{else}}
{{{item.label}}}: {{plusMoins item.value}} {{item.label}}: {{plusMoins item.value}}
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}