Skip to content

Can't change combatant order without updating combat turn #12990

Description

@pafvel

What happened?

In Foundry v12 it was possible to update the combatant order in the combat tracker without changing the index of the current turn by calling Combat.updateEmbeddedDocuments('Combatant', updates, { turnEvents: false }); This functionality is used by the Year Zero Engine: Combat module when swapping place in the combat tracker between two combatants.

In v13, this no longer works due to Combatant._preUpdateOperation adding a combatTurn to the operation.

I was able to get the same behaviour as before by adding an override in a subclass to Combatant:

static async _preUpdateOperation(_documents, operation, _user) {
    const removeCombatTurn = operation.turnEvents === false && operation.combatTurn === undefined;
    await super._preUpdateOperation(_documents, operation, _user);
    if (removeCombatTurn) {
      delete operation.combatTurn;
    }
  }

I reported a similar issue in the past. See #11531

What ways of accessing Foundry can you encounter this issue in?

  • Native App (Electron)
  • Chrome
  • Firefox
  • Safari
  • Other

Reproduction Steps

Foundry v 13.345
Year Zero Engine: Combat v1.3.5
Tested in Dragonbane, but should work in the same way in any system.

Repro steps
Combat Tracker:
1 Fighter << Current
2 Thief
3 Mage

Right-click Fighter and Swap Initiative with Mage
Note: if the swap initiative menu item is missing, press F5 to re-load (bugfix for this is on its way)
Result:
1 Mage
2 Thief
3 Fighter << Current

Expected Result:
1 Mage << Current
2 Thief
3 Fighter

What core version are you reporting this for?

13.345

Relevant log output

Bug Checklist

  • The issue occurs while all Modules are disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiIssues related to the API used by Mod DevscombatIssues related to Combat and the Combat TrackerwontfixIssues which will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions