Skip to content

End Encounter recovers uses even if it is canceled from the dialog prompt #6740

Description

@thatlonelybugbear
  async endCombat() {
    await super.endCombat();
    this._recoverUses({ turn: true, turnEnd: true, turnStart: true });
    return this;
  }

The _recoverUses is always triggered.

It might be down to Foundry to reimplement the endCombat in a more extensible friendly way (but the system should find a way to patch this bug essentially faster via deleteCombat probably).

This is from Foundry's code base

 async endCombat() {
    await foundry.applications.api.DialogV2.confirm({
      window: {title: "COMBAT.EndTitle"},
      content: `<p>${game.i18n.localize("COMBAT.EndConfirmation")}</p>`,
      yes: {callback: () => this.delete()},
      modal: true
    });
    return this;
  }

The way the deletion is hidden inside the dialog.yes means that the subclass caliing super.endCombat() can't distinguish confirm vs cancel from the return value alone.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions