foundryvtt / dnd5e

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

Active effect remaining duration does not update immediately on character sheet #2983

Open schultzcole opened 8 months ago

schultzcole commented 8 months ago

Repro:

If you just leave the sheet open, the duration on the sheet will update correctly the next time the actor becomes the active combatant because that's when the actor itself is updated and therefore the sheet is re-rendered.

schultzcole commented 8 months ago

This is kind of a tough one. The issue is that nothing on the effect is actually getting updated, since the remaining duration is computed based on the current world time and the start time of the effect, so the sheet doesn't know that it should re-render.

The only solution I can think of right now is to hook on combatRound from the sheet and re-render if the actor has any active effects with a duration.startTime. This should work, but I worry that it could increase the likelihood of people losing edits due to a sheet re-render that happened because the combat turn changed. Might be safer to wait for Applications V2 so we can selectively re-render the effects tab when the combat round updates.