Fix dépense rêve sort

La dépense de rêve de sort se faisait en parallèle de la fermeture
de fenêtre des TMRs, qui modifiait la fatigue. Du coup, l'update de
la dépense de rêve ne se faisait pas
This commit is contained in:
2025-11-27 01:02:09 +01:00
parent 764f9f81c8
commit acd40f3154
3 changed files with 22 additions and 17 deletions
+5 -5
View File
@@ -1726,16 +1726,16 @@ export class RdDActor extends RdDBaseActorSang {
type: { allowed: [ROLL_TYPE_SORT], current: ROLL_TYPE_SORT } type: { allowed: [ROLL_TYPE_SORT], current: ROLL_TYPE_SORT }
}; };
const dialog = await RollDialog.create(rollData, { const dialog = await RollDialog.create(rollData, {
callbacks: [roll => { callbacks: [async roll => {
this.tmrApp?.restoreTMRAfterAction(); await this.tmrApp?.restoreTMRAfterAction();
if (roll.closeTMR) { if (roll.closeTMR) {
this.tmrApp?.close(); await this.tmrApp?.close();
this.tmrApp = undefined; this.tmrApp = undefined;
} }
}], }],
onRollDone: RollDialog.onRollDoneClose, onRollDone: RollDialog.onRollDoneClose,
onClose: () => { onClose: async () => {
this.tmrApp?.restoreTMRAfterAction(); await this.tmrApp?.restoreTMRAfterAction();
} }
}); });
this.tmrApp?.setTMRPendingAction(dialog); this.tmrApp?.setTMRPendingAction(dialog);
+1 -1
View File
@@ -68,7 +68,7 @@ export class RdDRencontre extends RdDItem {
} }
static async appliquer(codes, tmrDialog, rencData) { static async appliquer(codes, tmrDialog, rencData) {
for(const effet of RdDRencontre.mapEffets(codes)){ for(let effet of RdDRencontre.mapEffets(codes)){
await effet.method(tmrDialog, rencData); await effet.method(tmrDialog, rencData);
} }
} }
+16 -11
View File
@@ -1,3 +1,4 @@
import { RollBasicParts } from "../roll/roll-basic-parts.mjs"
const ACTOR_EMBEDDED_DOCTYPES = ['Item', 'ActiveEffect'] const ACTOR_EMBEDDED_DOCTYPES = ['Item', 'ActiveEffect']
/** /**
@@ -62,14 +63,16 @@ export class ActorImpacts {
addDelta(document, path, value) { addDelta(document, path, value) {
ActorImpacts.$checkDocType(document) ActorImpacts.$checkDocType(document)
const intValue = Number.parseInt(value) const intValue = Number.parseInt(value)
if (Number.isInteger(intValue) && intValue != 0) { if (Number.isInteger(intValue)) {
const delta = [path, intValue] if (intValue != 0){
const existing = this[docType].updates.find(it => it.id == document.id) const delta = [path, intValue]
if (existing) { const existing = this[docType].updates.find(it => it.id == document.id)
existing.deltas.push(delta) if (existing) {
} existing.deltas.push(delta)
else { }
this[docType].updates.push({ id: document.id, updates: [], deltas: [delta] }) else {
this[docType].updates.push({ id: document.id, updates: [], deltas: [delta] })
}
} }
} }
else { else {
@@ -96,7 +99,9 @@ export class ActorImpacts {
async applyImpacts() { async applyImpacts() {
const actor = this.actorToken.actor const actor = this.actorToken.actor
await Promise.all(ACTOR_EMBEDDED_DOCTYPES.map(async docType => await this.$applyDocumentsImpacts(actor, docType))) for (let docType of ACTOR_EMBEDDED_DOCTYPES) {
await this.$applyDocumentsImpacts(actor, docType)
}
const updates = ActorImpacts.$computeUpdates(this, id => actor) const updates = ActorImpacts.$computeUpdates(this, id => actor)
await actor.update(updates, { render: true }) await actor.update(updates, { render: true })
} }
@@ -122,8 +127,8 @@ export class ActorImpacts {
} }
} }
findCreatedId(docType, origId){ findCreatedId(docType, origId) {
return this[docType].creates.find(it => it.id = origId)?.createdId return this[docType].creates.find(it => it.id = origId)?.createdId
} }
$getEmbeddedDocument(docType, id) { $getEmbeddedDocument(docType, id) {