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:
@@ -1726,16 +1726,16 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
type: { allowed: [ROLL_TYPE_SORT], current: ROLL_TYPE_SORT }
|
||||
};
|
||||
const dialog = await RollDialog.create(rollData, {
|
||||
callbacks: [roll => {
|
||||
this.tmrApp?.restoreTMRAfterAction();
|
||||
callbacks: [async roll => {
|
||||
await this.tmrApp?.restoreTMRAfterAction();
|
||||
if (roll.closeTMR) {
|
||||
this.tmrApp?.close();
|
||||
await this.tmrApp?.close();
|
||||
this.tmrApp = undefined;
|
||||
}
|
||||
}],
|
||||
onRollDone: RollDialog.onRollDoneClose,
|
||||
onClose: () => {
|
||||
this.tmrApp?.restoreTMRAfterAction();
|
||||
onClose: async () => {
|
||||
await this.tmrApp?.restoreTMRAfterAction();
|
||||
}
|
||||
});
|
||||
this.tmrApp?.setTMRPendingAction(dialog);
|
||||
|
||||
@@ -68,7 +68,7 @@ export class RdDRencontre extends RdDItem {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { RollBasicParts } from "../roll/roll-basic-parts.mjs"
|
||||
|
||||
const ACTOR_EMBEDDED_DOCTYPES = ['Item', 'ActiveEffect']
|
||||
/**
|
||||
@@ -62,14 +63,16 @@ export class ActorImpacts {
|
||||
addDelta(document, path, value) {
|
||||
ActorImpacts.$checkDocType(document)
|
||||
const intValue = Number.parseInt(value)
|
||||
if (Number.isInteger(intValue) && intValue != 0) {
|
||||
const delta = [path, intValue]
|
||||
const existing = this[docType].updates.find(it => it.id == document.id)
|
||||
if (existing) {
|
||||
existing.deltas.push(delta)
|
||||
}
|
||||
else {
|
||||
this[docType].updates.push({ id: document.id, updates: [], deltas: [delta] })
|
||||
if (Number.isInteger(intValue)) {
|
||||
if (intValue != 0){
|
||||
const delta = [path, intValue]
|
||||
const existing = this[docType].updates.find(it => it.id == document.id)
|
||||
if (existing) {
|
||||
existing.deltas.push(delta)
|
||||
}
|
||||
else {
|
||||
this[docType].updates.push({ id: document.id, updates: [], deltas: [delta] })
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -96,7 +99,9 @@ export class ActorImpacts {
|
||||
|
||||
async applyImpacts() {
|
||||
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)
|
||||
await actor.update(updates, { render: true })
|
||||
}
|
||||
@@ -122,8 +127,8 @@ export class ActorImpacts {
|
||||
}
|
||||
}
|
||||
|
||||
findCreatedId(docType, origId){
|
||||
return this[docType].creates.find(it => it.id = origId)?.createdId
|
||||
findCreatedId(docType, origId) {
|
||||
return this[docType].creates.find(it => it.id = origId)?.createdId
|
||||
}
|
||||
|
||||
$getEmbeddedDocument(docType, id) {
|
||||
|
||||
Reference in New Issue
Block a user