10.0.32 #570

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-10-31 23:04:42 +01:00
15 changed files with 58 additions and 41 deletions

View File

@ -1426,34 +1426,32 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async actionRefoulement(item) { async actionRefoulement(item) {
const refoulement = item?.system.refoulement ?? 0; const refoulement = item?.system.refoulement ?? 0;
if (refoulement>0) { if (refoulement > 0) {
RdDConfirm.confirmer({ RdDConfirm.confirmer({
settingConfirmer: "confirmation-refouler", settingConfirmer: "confirmation-refouler",
content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`, content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`,
title: 'Confirmer la refoulement', title: 'Confirmer la refoulement',
buttonLabel: 'Refouler', buttonLabel: 'Refouler',
onAction: async () => { onAction: async () => {
ChatMessage.create({ await this.ajouterRefoulement(refoulement, `une queue ${item.name}`);
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement`
});
await this.ajouterRefoulement(refoulement);
await item.delete(); await item.delete();
} }
}) });
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async ajouterRefoulement(value = 1) { async ajouterRefoulement(value = 1, refouler) {
let refoulement = this.system.reve.refoulement.value + value; const refoulement = this.system.reve.refoulement.value + value;
let total = await RdDDice.rollTotal("1d20"); const roll = new Roll("1d20");
if (total <= refoulement) { await roll.evaluate({ async: true });
await roll.toMessage({ flavor: `${this.name} refoule ${refouler} pour ${value} points de refoulement (total: ${refoulement})` });
if (roll.total <= refoulement) {
refoulement = 0; refoulement = 0;
await this.ajouterSouffle({ chat: true }); await this.ajouterSouffle({ chat: true });
} }
await this.update({ "system.reve.refoulement.value": refoulement }); await this.update({ "system.reve.refoulement.value": refoulement });
return refoulement == 0 ? "souffle" : "none"; return roll;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -85,9 +85,9 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getVoieDraconic(competences, voie) { static getVoieDraconic(competences, voie) {
return RdDItemCompetence.findFirstItem(competences, voie, { return RdDItemCompetence.findFirstItem(competences, voie, {
preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it), preFilter: it => it.isCompetence() && RdDItemCompetence.isDraconic(it),
description: 'Draconic', description: 'Draconic',
}); });
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -199,7 +199,7 @@ export class RdDItemCompetence extends Item {
item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype); item.system.isStressLevelUp = (xpManquant > 0 && stressTransforme >= xpManquant && item.system.niveau < item.system.niveau_archetype);
item.system.stressXpMax = 0; item.system.stressXpMax = 0;
if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) { if (xpManquant > 0 && stressTransforme > 0 && item.system.niveau < item.system.niveau_archetype) {
item.system.stressXpMax = Math.min(xpManquant , stressTransforme); item.system.stressXpMax = Math.min(xpManquant, stressTransforme);
} }
} }
@ -219,10 +219,10 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static findCompetence(list, idOrName, options = {}) { static findCompetence(list, idOrName, options = {}) {
if (idOrName == undefined) { if (idOrName == undefined || idOrName == "") {
return undefined; return RdDItemCompetence.sansCompetence();
} }
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, {overwrite: false}); options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false });
return RdDItemCompetence.findFirstItem(list, idOrName, options); return RdDItemCompetence.findFirstItem(list, idOrName, options);
} }
@ -231,6 +231,23 @@ 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 sansCompetence() {
return {
name: "Sans compétence",
type: "competence",
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.webp",
system: {
niveau: 0,
default_diffLibre: 0,
base: 0,
categorie: "Aucune",
description: "",
descriptionmj: "",
defaut_carac: "",
}
};
}
static findFirstItem(list, idOrName, options) { static findFirstItem(list, idOrName, options) {
return list.find(it => it.id == idOrName && options.preFilter(it)) return list.find(it => it.id == idOrName && options.preFilter(it))
?? Misc.findFirstLike(idOrName, list, options); ?? Misc.findFirstLike(idOrName, list, options);

View File

@ -289,9 +289,8 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async refouler() { async refouler() {
this._tellToGM(this.actor.name + " a refoulé : " + this.currentRencontre.name); await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1, `une rencontre ${this.currentRencontre.name}`);
await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
await this.actor.ajouterRefoulement(this.currentRencontre.refoulement ?? 1);
this.updateTokens(); this.updateTokens();
console.log("-> refouler", this.currentRencontre) console.log("-> refouler", this.currentRencontre)
this.updateValuesDisplay(); this.updateValuesDisplay();
@ -300,7 +299,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */ /* -------------------------------------------- */
async ignorerRencontre() { async ignorerRencontre() {
this._tellToGM(this.actor.name + " a ignoré : " + this.currentRencontre.name); this._tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary await this.actor.deleteTMRRencontreAtPosition(); // Remove the stored rencontre if necessary
this.updateTokens(); this.updateTokens();
this.updateValuesDisplay(); this.updateValuesDisplay();

View File

@ -280,7 +280,7 @@ export class RdDUtility {
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord)); Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1))); Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
Handlebars.registerHelper('regle-optionnelle', (option) => ReglesOptionelles.isUsing(option)); Handlebars.registerHelper('regle-optionnelle', (option) => ReglesOptionelles.isUsing(option));
Handlebars.registerHelper('trier', competences => competences.sort((a, b) => a.name.localeCompare(b.name)));
Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.system.isVisible) Handlebars.registerHelper('filtreTriCompetences', competences => competences.filter(it => it.system.isVisible)
.sort((a, b) => { .sort((a, b) => {
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) { if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {

BIN
styles/img/apercu.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

View File

@ -1583,7 +1583,7 @@ display: inline-flex;
padding: 3px; padding: 3px;
} }
.tooltip .ttt-xp { .tooltip :is(.ttt-xp,.ttt-levelup) {
width: 250px; width: 250px;
background: rgba(220,220,210,0.95) !important; background: rgba(220,220,210,0.95) !important;
border-radius: 6px; border-radius: 6px;

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": "10.0.31", "version": "10.0.32",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.31.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.0.32.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",
@ -353,7 +353,7 @@
}, },
{ {
"type": "screenshot", "type": "screenshot",
"url": "http://www.lahiette.com/leratierbretonnien/wp-content/uploads/2020/11/Screenshot_20201128_181102.webp", "url": "systems/foundryvtt-reve-de-dragon/styles/img/apercu.webp",
"caption": "Capture d'écran de Rêve de Dragon sur Foundry" "caption": "Capture d'écran de Rêve de Dragon sur Foundry"
} }
] ]

View File

@ -746,9 +746,9 @@
"carac": "", "carac": "",
"competence": "", "competence": "",
"periodicite": "", "periodicite": "",
"fatigue": 0, "fatigue": 1,
"difficulte": 0, "difficulte": 0,
"points_de_tache": 0, "points_de_tache": 4,
"points_de_tache_courant": 0, "points_de_tache_courant": 0,
"nb_jet_echec": 0, "nb_jet_echec": 0,
"nb_jet_succes": 0, "nb_jet_succes": 0,

View File

@ -11,13 +11,13 @@
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}
{{#if carac.derivee}} {{#if carac.derivee}}
<span class="carac-label" name="system.carac.{{key}}.label"> <a name={{key}}>{{carac.label}}</a></span> <span class="carac-label" name="system.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
<label class="competence-value">{{carac.value}}</label> <label class="competence-value">{{carac.value}}</label>
<label class="carac-xp"/> <label class="carac-xp"/>
{{else}} {{else}}
{{#if carac.isLevelUp}} {{#if carac.isLevelUp}}
<span class="carac-label tooltip" name="system.carac.{{key}}.label"> <span class="carac-label tooltip" name="system.carac.{{key}}.label">
<span class="tooltiptext ttt-xp"> <span class="tooltiptext ttt-levelup">
Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}} Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}}
</span> </span>
<a name={{key}}>{{carac.label}}</a></span> <a name={{key}}>{{carac.label}}</a></span>
@ -26,8 +26,8 @@
{{/if}} {{/if}}
<input class="carac-value" type="text" name="system.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} /> <input class="carac-value" type="text" name="system.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
<span class="carac-xp tooltip"> <span class="carac-xp tooltip">
<input class="carac-xp" type="text" name="system.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} /> <input class="carac-xp" type="text" name="system.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
<span class="tooltiptext ttt-xp">Vous devez acquérir {{carac.xpNext}} points d'Experience pour augmenter de 1 votre {{carac.label}}</span> <span class="tooltiptext ttt-xp">Vous devez acquérir {{carac.xpNext}} points d'Experience pour augmenter de 1 votre {{carac.label}}</span>
</span> </span>
{{#if carac.isLevelUp}} {{#if carac.isLevelUp}}
<a class="carac-xp-augmenter" name="augmenter.{{key}}" title="Augmenter"> <a class="carac-xp-augmenter" name="augmenter.{{key}}" title="Augmenter">

View File

@ -1,5 +1,5 @@
<ol class="item-list alterne-list"> <ol class="item-list alterne-list">
{{#each competences as |comp key|}} {{#each (trier competences) as |comp key|}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
<a class="competence-label"> <a class="competence-label">
<img class="sheet-competence-img" src="{{comp.img}}" /> <img class="sheet-competence-img" src="{{comp.img}}" />

View File

@ -6,7 +6,7 @@
</a> </a>
{{#if system.isLevelUp}} {{#if system.isLevelUp}}
<span class="tooltiptext ttt-xp">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}}" title="Augmenter"> <a class="competence-xp-augmenter" compname="{{name}}" title="Augmenter">
<i class="fas fa-arrow-alt-circle-up"></i> <i class="fas fa-arrow-alt-circle-up"></i>
</a> </a>
@ -17,10 +17,12 @@
{{#unless @root.options.vueDetaillee}}disabled{{/unless}} /> {{#unless @root.options.vueDetaillee}}disabled{{/unless}} />
{{#if @root.options.vueDetaillee}} {{#if @root.options.vueDetaillee}}
<span class="competence-xp tooltip"> <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"/>
{{#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>
{{/unless}}
</span> </span>
{{/if}} {{/if}}
{{#if (eq system.categorie 'draconic')}} {{#if (eq system.categorie 'draconic')}}

View File

@ -21,7 +21,7 @@
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String"> <select name="system.competence" id="competenceselect" data-dtype="String">
{{#select system.competence}} {{#select system.competence}}
{{#each competences as |competence key|}} {{#each (trier competences) as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}

View File

@ -6,7 +6,7 @@
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String"> <select name="system.competence" id="competenceselect" data-dtype="String">
{{#select system.competence}} {{#select system.competence}}
{{#each competences as |competence key|}} {{#each (trier competences) as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}

View File

@ -20,7 +20,7 @@
<label>Compétence</label> <label>Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String"> <select name="system.competence" id="competenceselect" data-dtype="String">
{{#select system.competence}} {{#select system.competence}}
{{#each competences as |competence key|}} {{#each (trier competences) as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}

View File

@ -16,7 +16,8 @@
<label for="xp">Compétence</label> <label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String"> <select name="system.competence" id="competenceselect" data-dtype="String">
{{#select system.competence}} {{#select system.competence}}
{{#each competences as |competence key|}} <option value="">Sans compétence</option>
{{#each (trier competences) as |competence key|}}
<option value="{{competence.name}}">{{competence.name}}</option> <option value="{{competence.name}}">{{competence.name}}</option>
{{/each}} {{/each}}
{{/select}} {{/select}}