Compare commits
No commits in common. "3ac9f487d0ec64089e4dca7d90aad2995d9cf0d6" and "5b443f9ac08d42632aa3ed532144ebf18616c0ee" have entirely different histories.
3ac9f487d0
...
5b443f9ac0
@ -152,26 +152,23 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async $perteRevePotionsEnchantees() {
|
async $perteRevePotionsEnchantees() {
|
||||||
let potions = this.itemTypes[TYPES.potion]
|
let potions = this.itemTypes[TYPES.potion]
|
||||||
.filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent)
|
.filter(it => it.system.categorie.toLowerCase().includes('enchant') && !potion.system.prpermanent)
|
||||||
|
|
||||||
const potionUpdates = await Promise.all(potions.map(async it => {
|
const potionUpdates = await Promise.all(potions.map(async potion => {
|
||||||
const nouveauReve = Math.max(it.system.pr - 1, 0)
|
console.log(potion)
|
||||||
|
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: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
|
content: message
|
||||||
pr: nouveauReve,
|
});
|
||||||
alias: this.name,
|
return { _id: potion._id, 'system.pr': nouveauReve };
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user