foundryvtt / dnd5e

An implementation of the 5th Edition game system for Foundry Virtual Tabletop (http://foundryvtt.com).
MIT License
339 stars 226 forks source link

Synthetic actor with a saving throw that applies an active effect, and rolls damage, has the effect deleted after rolling damage and refreshing #4703

Open etiquettestartshere opened 1 week ago

etiquettestartshere commented 1 week ago

Title may be a little unclear: the issue is a little unclear. Included below is an actor to reproduce the steps minimally.

  1. Create an npc type actor.
  2. Import the json, or, alternatively, create a feature type item, a save activity on it, an active effect applied by the save, and a damage roll.
  3. Drag the actor from the sidebar to the scene, creating a synthetic actor (WITHOUT rolling any of the actor's features from the base actor in the sidebar).
  4. From its sheet, use the synthetic actor's feature, prompting the save's chat card to appear (seems to work whether or not it really has a save on it). AT THIS POINT, it is still possible to refresh and not lose the active effect.
  5. Use the damage button, and roll damage. This step is essential.
  6. Refresh. The active effect will be gone.

fvtt-Actor-non-player-character-zLxuKNAjqFo7PCpe.json

Because of the unclear nature of this issue, please tell me if I should move it to the core repo. No errors are produced in console, but this node error can be observed: image

krbz999 commented 1 week ago

Simpler steps to reproduce:

The above repro steps caused the issue because rollDamage calls setFlag.

krbz999 commented 1 week ago

The above steps reproduced this in SWADE as well.

etiquettestartshere commented 1 week ago

Assuming this is a core issue that wont be fixed until v13, it may be best in the present for the system to check if the actor is synthetic before storing information about the last damage type in this way. At least personally, I'd rather not know that or have to pick it again in the dialog in the rare cases my synthetic actor has more than one damage type on its save damage, vs having to make a new copy of the active effect or actor.