v10.6.13 #624
@ -457,7 +457,20 @@ export class RdDActor extends RdDBaseActor {
|
||||
|
||||
async _jetDeMoralChateauDormant(message) {
|
||||
const jetMoral = await this._jetDeMoral('neutre');
|
||||
message.content += jetMoral.ajustement == 0 ? ' -- le moral reste stable' : ' -- le moral retourne vers 0';
|
||||
message.content += ' -- le moral ' + this._messageAjustementMoral(jetMoral.ajustement);
|
||||
}
|
||||
_messageAjustementMoral(ajustement) {
|
||||
switch (Math.sign(ajustement)) {
|
||||
case 1:
|
||||
return `remonte de ${ajustement}`;
|
||||
case -1:
|
||||
return `diminue de ${-ajustement}`;
|
||||
case 0:
|
||||
return 'reste stable';
|
||||
default:
|
||||
console.error(`Le signe de l'ajustement de moral ${ajustement} est ${Math.sign(ajustement)}, ce qui est innatendu`)
|
||||
return `est ajusté de ${ajustement} (bizarre)`;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -52,28 +52,28 @@ export class RdDBaseActorSheet extends ActorSheet {
|
||||
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
this._appliquerRechercheObjets(formData.objets, formData.conteneurs, this.options.recherche);
|
||||
this._appliquerRechercheObjets(formData.objets, formData.conteneurs);
|
||||
return formData;
|
||||
}
|
||||
|
||||
_appliquerRechercheObjets(objets, conteneurs, recherche) {
|
||||
if (recherche) {
|
||||
this._setConteneursVisibles(objets, conteneurs);
|
||||
_appliquerRechercheObjets(objets, conteneurs) {
|
||||
if (this.options.recherche?.text) {
|
||||
const recherche = this.options.recherche;
|
||||
const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id);
|
||||
let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id)
|
||||
do {
|
||||
allVisible.push(...addVisible)
|
||||
const parentsIds = conteneurs.filter(it => it.system.contenu.find(id => allVisible.includes(id))).map(it => it.id)
|
||||
addVisible = parentsIds.filter(id => !allVisible.includes(id))
|
||||
}
|
||||
while (addVisible.length > 0)
|
||||
objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
|
||||
conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
|
||||
}
|
||||
}
|
||||
|
||||
_setConteneursVisibles(objets, conteneurs) {
|
||||
const recherche = this.options.recherche;
|
||||
const allVisible = objets.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id);
|
||||
let addVisible = conteneurs.filter(it => it.isNomTypeLike(recherche.text)).map(it => it.id)
|
||||
do {
|
||||
allVisible.push(...addVisible)
|
||||
const parentsIds = conteneurs.filter(it => it.system.contenu.find(id => allVisible.includes(id))).map(it => it.id)
|
||||
addVisible = parentsIds.filter(id => !allVisible.includes(id))
|
||||
else {
|
||||
objets.forEach(it => it.system.isHidden = false)
|
||||
conteneurs.forEach(it => it.system.isHidden = false)
|
||||
}
|
||||
while (addVisible.length > 0)
|
||||
objets.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
|
||||
conteneurs.forEach(it => it.system.isHidden = !allVisible.includes(it.id))
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -164,12 +164,8 @@ export class RdDBaseActorSheet extends ActorSheet {
|
||||
.each((index, field) => {
|
||||
this._rechercheSelectArea(field);
|
||||
})
|
||||
.keyup(async event => {
|
||||
this._rechercherKeyup(event);
|
||||
})
|
||||
.change(async event =>
|
||||
this.options.recherche = this._optionRecherche(event.currentTarget)
|
||||
);
|
||||
.keyup(async event => this._rechercherKeyup(event))
|
||||
.change(async event => this._rechercherKeyup(event));
|
||||
}
|
||||
|
||||
_rechercherKeyup(event) {
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "10.6.12",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.12.zip",
|
||||
"version": "10.6.13",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.13.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
|
@ -1,3 +1,4 @@
|
||||
{{#unless item.system.isHidden}}
|
||||
{{#if (ne item.type 'monnaie')}}
|
||||
<li class="item flexrow list-item" data-item-id="{{item._id}}" draggable="true">
|
||||
<span class="equipement-nom {{#if (eq item.type 'conteneur')}}conteneur-name{{/if}} ">
|
||||
@ -57,3 +58,4 @@
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/unless}}
|
@ -4,6 +4,9 @@
|
||||
<a class="chat-card-button creer-un-objet">Nouvel objet</a>
|
||||
<a class="chat-card-button nettoyer-conteneurs">Tout vider</a>
|
||||
{{/if}}
|
||||
<span class="embed-inline">
|
||||
<input class="recherche flex-grow" type="text" value="{{options.recherche.text}}" name="recherche" size="8" data-dtype="String" placeholder=""/>
|
||||
</span>
|
||||
|
||||
{{#unless system.illimite}}
|
||||
{{#if calc.surEncombrementMessage}}<b>{{calc.surEncombrementMessage}}</b> ‐{{/if}}
|
||||
|
Loading…
Reference in New Issue
Block a user