Bugfixes #565

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-10-14 22:52:09 +02:00
9 changed files with 37 additions and 28 deletions

View File

@ -2293,12 +2293,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
computeDraconicAndSortIndex(sortList) { computeDraconicAndSortIndex(sortList) {
let draconicList = this.getDraconicList() let draconicList = this.getDraconicList();
.map(it => {
it = duplicate(it)
it.system.defaut_carac = "reve";
return it;
});
for (let sort of sortList) { for (let sort of sortList) {
let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name); let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name);
for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) { 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) { 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) { if (idOrName == undefined) {
return undefined; return undefined;
} }
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence', }); options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false});
return list.find(it => it.id == idOrName && it.isCompetence()) return RdDItemCompetence.findFirstItem(list, idOrName, options);
?? Misc.findFirstLike(idOrName, list, options);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -229,6 +231,11 @@ export class RdDItemCompetence extends Item {
return Misc.findAllLike(name, list, { filter: it => it.isCompetence(), description: 'compétence' }); 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) { static getCompetenceNextXp(niveau) {
return RdDItemCompetence.getCompetenceXp(niveau + 1); return RdDItemCompetence.getCompetenceXp(niveau + 1);

View File

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

View File

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

View File

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

View File

@ -1,6 +1,13 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve 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", "description": "Rêve de Dragon RPG for FoundryVTT",
"authors": [ "authors": [
{ {
@ -34,11 +41,6 @@
], ],
"url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/", "url": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"version": "10.0.27",
"compatibility": {
"minimum": "10",
"verified": "10.287"
},
"esmodules": [ "esmodules": [
"module/rdd-main.js" "module/rdd-main.js"
], ],
@ -332,8 +334,6 @@
} }
], ],
"socket": true, "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, "gridDistance": 1,
"gridUnits": "m", "gridUnits": "m",
"primaryTokenAttribute": "sante.vie", "primaryTokenAttribute": "sante.vie",

View File

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

View File

@ -2,15 +2,15 @@
<h4>Equipement</h4> <h4>Equipement</h4>
<span class="item-name"> <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> <a class="chat-card-button creer-un-objet">Nouvel objet</a>
{{#if options.isGM}} {{#if options.isGM}}
<a class="chat-card-button nettoyer-conteneurs">Tout vider</a> <a class="chat-card-button nettoyer-conteneurs">Tout vider</a>
{{/if}} {{/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> </span>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
<li class="competence-header flexrow"> <li class="competence-header flexrow">

View File

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