Merge pull request 'v11' (#689) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11

Reviewed-on: #689
This commit is contained in:
uberwald 2023-12-08 13:24:05 +01:00
commit e4bd2d2f27
9 changed files with 49 additions and 40 deletions

View File

@ -1,4 +1,9 @@
# 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
- 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

View File

@ -22,6 +22,10 @@ export class Misc {
const isPositiveNumber = value != NaN && value > 0;
return isPositiveNumber ? "+" + number : number
}
static modulo(n, m) {
return ((n % m) + m) % m;
}
static sum() {
return (a, b) => Number(a) + Number(b);

View File

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

View File

@ -64,19 +64,19 @@ export const referenceAjustements = {
},
encTotal: {
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',
getValue: (rollData, actor) => -actor.getEncTotal()
},
surenc: {
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',
getValue: (rollData, actor) => actor.computeMalusSurEncombrement()
},
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',
getValue: (rollData, actor) => 1
},
@ -84,7 +84,7 @@ export const referenceAjustements = {
isVisible: (rollData, actor) => actor.isPersonnage() && RdDCarac.isVolonte(rollData.selectedCarac),
isUsed: (rollData, actor) => rollData.use.coeur != undefined,
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: {
isUsed: (rollData, actor) => RdDCarac.isVolonte(rollData.selectedCarac),
@ -141,7 +141,7 @@ export const referenceAjustements = {
getLabel: (rollData, actor) => "Force de l'alcool: ",
getValue: (rollData, actor) => rollData.forceAlcool,
},
ethylisme:{
ethylisme: {
isVisible: (rollData, actor) => rollData.ethylisme != undefined,
isUsed: (rollData, actor) => rollData.ethylisme != undefined,
getLabel: (rollData, actor) => "Ethylisme - " + RdDUtility.getNomEthylisme(rollData.ethylisme),
@ -159,7 +159,9 @@ export class RollDataAjustements {
/* -------------------------------------------- */
static calcul(rollData, actor) {
rollData.ajustements = {};
// s'assurer de la correction des infos rollData
mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
for (var key in referenceAjustements) {
const reference = referenceAjustements[key];
rollData.ajustements[key] = {

View File

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

View File

@ -1,8 +1,8 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "11.2.7",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.7.zip",
"version": "11.2.8",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-11.2.8.zip",
"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",
"compatibility": {

View File

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

View File

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

View File

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