_applyRelatedEffects does the application individually using a loop rather than applying them in one update
In order to submit an effective bug report, please include the following information along with your issue description.
Environment Details
Please share the following basic details about your setup.
- Foundry VTT Version: 11.315
- SWADE System Version: 3.3.3
Issue Description
In _applyRelatedEffects, we loop over the related effects and call toggleActiveEffect for each. This results in several modifications happening at the same time (e.g. stunned applies dist, vuln, and prone individually). This can cause race conditions in other code.
Possible Solution and/or Root Cause
The function should be updated to gather all related changes and then apply them in a single call, likely using parent.updateEmbeddedDocuments.