Compare commits

...

2 Commits

Author SHA1 Message Date
3ac9f487d0 Fix: perte de rêve potions enchantées
La perte de rêve des potions enchantées bloquait le processus de
récupération de château dormant
2023-12-22 20:12:58 +01:00
fa67c3d9c1 Merge pull request 'Version 11.2.11' (#692) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: public/foundryvtt-reve-de-dragon#692
2023-12-22 09:30:48 +01:00

View File

@ -152,23 +152,26 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async $perteRevePotionsEnchantees() { async $perteRevePotionsEnchantees() {
let potions = this.itemTypes[TYPES.potion] let potions = this.itemTypes[TYPES.potion]
.filter(it => it.system.categorie.toLowerCase().includes('enchant') && !potion.system.prpermanent) .filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent)
const potionUpdates = await Promise.all(potions.map(async potion => { const potionUpdates = await Promise.all(potions.map(async it => {
console.log(potion) const nouveauReve = Math.max(it.system.pr - 1, 0)
let nouveauReve = (potion.system.pr > 0) ? potion.system.pr - 1 : 0;
const message = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
pr: nouveauReve,
alias: this.name,
potionName: potion.name,
potionImg: potion.img
})
ChatMessage.create({ ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name), whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: message content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
}); pr: nouveauReve,
return { _id: potion._id, 'system.pr': nouveauReve }; alias: this.name,
potionName: it.name,
potionImg: it.img
})
})
return {
_id: it._id,
'system.pr': nouveauReve,
'system.quantite': nouveauReve > 0 ? it.system.quantite : 0
}
})) }))
await this.updateEmbeddedDocuments('Item', potionUpdates); await this.updateEmbeddedDocuments('Item', potionUpdates);
} }