Merge pull request 'Bugfixes' (#565) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10

Reviewed-on: #565
This commit is contained in:
uberwald 2022-10-14 22:52:08 +02:00
commit 8bb2afe83e
9 changed files with 37 additions and 28 deletions

View File

@ -2293,12 +2293,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
computeDraconicAndSortIndex(sortList) {
let draconicList = this.getDraconicList()
.map(it => {
it = duplicate(it)
it.system.defaut_carac = "reve";
return it;
});
let draconicList = this.getDraconicList();
for (let sort of sortList) {
let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name);
for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) {

View File

@ -84,7 +84,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static getVoieDraconic(competences, voie) {
return RdDItemCompetence.findCompetence(competences.filter(it => RdDItemCompetence.isDraconic(it)), voie);
return RdDItemCompetence.findFirstItem(competences, voie, {
preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it),
description: 'Draconic',
});
}
/* -------------------------------------------- */
@ -219,9 +222,8 @@ export class RdDItemCompetence extends Item {
if (idOrName == undefined) {
return undefined;
}
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence', });
return list.find(it => it.id == idOrName && it.isCompetence())
?? Misc.findFirstLike(idOrName, list, options);
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false});
return RdDItemCompetence.findFirstItem(list, idOrName, options);
}
/* -------------------------------------------- */
@ -229,6 +231,11 @@ export class RdDItemCompetence extends Item {
return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' });
}
static findFirstItem(list, idOrName, options) {
return list.find(it => it.id == idOrName && options.preFilter(it))
?? Misc.findFirstLike(idOrName, list, options);
}
/* -------------------------------------------- */
static getCompetenceNextXp(niveau) {
return RdDItemCompetence.getCompetenceXp(niveau + 1);

View File

@ -71,9 +71,12 @@ export class Monnaie {
let updates = [];
let parValeur = Misc.classifyFirst(monnaies, it => it.system.valeur_deniers);
for (let valeur of [1000, 100, 10, 1]) {
if (parValeur[valeur]) {
const itemPiece = parValeur[valeur];
const piecesDeCetteValeur = Math.floor(reste / valeur);
if (itemPiece) {
if (piecesDeCetteValeur != itemPiece.system.quantite) {
updates.push({ _id: parValeur[valeur].id, 'system.quantite': piecesDeCetteValeur });
}
reste -= piecesDeCetteValeur*valeur;
}
}

View File

@ -51,6 +51,7 @@ export class RdDEncaisser extends Dialog {
this.actor.encaisserDommages({
dmg: {
total: Number(this.modifier),
ajustement: Number(this.modifier),
encaisserSpecial: this.encaisserSpecial,
loc: { result: 0, label: "" },
mortalite: mortalite

View File

@ -2,14 +2,14 @@ export class RdDRollTables {
/* -------------------------------------------- */
static async genericGetTableResult(tableName, toChat) {
let table = RdDRollTables.getWorldTable() ?? (await RdDRollTables.getSystemTable(tableName));
let table = RdDRollTables.getWorldTable(tableName) ?? (await RdDRollTables.getSystemTable(tableName));
const draw = await table.draw({ displayChat: toChat, rollMode: "gmroll"});
//console.log("RdDRollTables", tableName, toChat, ":", draw);
return draw.results.length > 0 ? draw.results[0] : undefined;
}
static getWorldTable() {
static getWorldTable(tableName) {
return game.tables.find(table => table.name.toLowerCase() == tableName.toLowerCase());
}

View File

@ -1,6 +1,13 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "10.0.28",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.28.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": {
"minimum": "10",
"verified": "10.288"
},
"description": "Rêve de Dragon RPG for FoundryVTT",
"authors": [
{
@ -34,11 +41,6 @@
],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt",
"version": "10.0.27",
"compatibility": {
"minimum": "10",
"verified": "10.287"
},
"esmodules": [
"module/rdd-main.js"
],
@ -332,8 +334,6 @@
}
],
"socket": true,
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.27.zip",
"gridDistance": 1,
"gridUnits": "m",
"primaryTokenAttribute": "sante.vie",

View File

@ -4,7 +4,7 @@
{{#if (and queues.length ombres.length)}} et {{/if}}
{{#if ombres.length}}Ombres de Thanatos{{/if}}
</h3>
<ul class="flex-group-left">
<ul class="item-list">
{{#each queues as |queue key|}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html" queue=queue key=key}}
{{/each}}

View File

@ -2,15 +2,15 @@
<h4>Equipement</h4>
<span class="item-name">
Encombrement: {{numberFormat calc.encTotal decimals=2}} (max: {{system.attributs.encombrement.value}}){{#if calc.surEncombrementMessage}}<b>{{calc.surEncombrementMessage}}</b>{{/if}}
{{#if (regle-optionnelle 'afficher-prix-joueurs')}}
&hyphen; Valeur: {{numberFormat calc.prixTotalEquipement decimals=2}} Sols
{{/if}}
&hyphen;
<a class="chat-card-button creer-un-objet">Nouvel objet</a>
{{#if options.isGM}}
<a class="chat-card-button nettoyer-conteneurs">Tout vider</a>
{{/if}}
{{#if calc.surEncombrementMessage}}<b>{{calc.surEncombrementMessage}}</b> &hyphen;{{/if}}
Encombrement: {{numberFormat calc.encTotal decimals=2}} (max: {{system.attributs.encombrement.value}})
{{#if (regle-optionnelle 'afficher-prix-joueurs')}}
&hyphen; Valeur: {{numberFormat calc.prixTotalEquipement decimals=2}} Sols
{{/if}}
</span>
<ul class="item-list alterne-list">
<li class="competence-header flexrow">

View File

@ -19,6 +19,9 @@
<div>Pénétration: -{{rollData.dmg.penetration}}</div>
{{/if}}
<hr>
{{#if encaissement.dmg.total}}
<div>+dom encaissement: {{numberFormat rollData.dmg.total decimals=0 sign=true}}</div>
{{/if}}
{{#if rollData.dmg.dmgArme}}
<div>+dom arme: {{numberFormat rollData.dmg.dmgArme decimals=0 sign=true}}</div>
{{/if}}