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

Reviewed-on: public/foundryvtt-reve-de-dragon#570
This commit is contained in:
uberwald 2022-10-31 23:04:41 +01:00
commit f6a3ec8634
15 changed files with 58 additions and 41 deletions

View File

@ -1433,27 +1433,25 @@ export class RdDActor extends Actor {
title: 'Confirmer la refoulement',
buttonLabel: 'Refouler',
onAction: async () => {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement`
});
await this.ajouterRefoulement(refoulement);
await this.ajouterRefoulement(refoulement, `une queue ${item.name}`);
await item.delete();
}
})
});
}
}
/* -------------------------------------------- */
async ajouterRefoulement(value = 1) {
let refoulement = this.system.reve.refoulement.value + value;
let total = await RdDDice.rollTotal("1d20");
if (total <= refoulement) {
async ajouterRefoulement(value = 1, refouler) {
const refoulement = this.system.reve.refoulement.value + value;
const roll = new Roll("1d20");
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;
await this.ajouterSouffle({ chat: true });
}
await this.update({ "system.reve.refoulement.value": refoulement });
return refoulement == 0 ? "souffle" : "none";
return roll;
}
/* -------------------------------------------- */

View File

@ -219,8 +219,8 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static findCompetence(list, idOrName, options = {}) {
if (idOrName == undefined) {
return undefined;
if (idOrName == undefined || idOrName == "") {
return RdDItemCompetence.sansCompetence();
}
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false });
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' });
}
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) {
return list.find(it => it.id == idOrName && options.preFilter(it))
?? Misc.findFirstLike(idOrName, list, options);

View File

@ -289,9 +289,8 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
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.ajouterRefoulement(this.currentRencontre.refoulement ?? 1);
this.updateTokens();
console.log("-> refouler", this.currentRencontre)
this.updateValuesDisplay();

View File

@ -280,7 +280,7 @@ export class RdDUtility {
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
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)
.sort((a, b) => {
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;
}
.tooltip .ttt-xp {
.tooltip :is(.ttt-xp,.ttt-levelup) {
width: 250px;
background: rgba(220,220,210,0.95) !important;
border-radius: 6px;

View File

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

View File

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

View File

@ -17,7 +17,7 @@
{{else}}
{{#if carac.isLevelUp}}
<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}}
</span>
<a name={{key}}>{{carac.label}}</a></span>

View File

@ -1,5 +1,5 @@
<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}}">
<a class="competence-label">
<img class="sheet-competence-img" src="{{comp.img}}" />

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,8 @@
<label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String">
{{#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>
{{/each}}
{{/select}}