foundryvtt / dnd5e

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

Fix preparation of movement/senses ranges and units #3561

Closed dev7355608 closed 2 weeks ago

dev7355608 commented 2 weeks ago

I noticed in certain cases we currently end up with prepared null range/units instead of 0/"ft".

Fyorl commented 2 weeks ago

Units should probably be initialised to some default, but null is a valid value for these NumberFields. We don't prepare every single NumberField in the schema to 0 so it's unclear why doing so for these particular fields is necessary.

dev7355608 commented 2 weeks ago

The units need to be initialized to for prepareMovement. The movement units are null, some of the movement reductions have no effect. No null ranges would be nice to have so that downstream code doesn't have to deal with that. In the context of detection modes a range of null is infinity: so there are chances that things go wrong with null ranges and a missing ?? 0 if the detection modes are prepared from the actors senses.

Fyorl commented 2 weeks ago

The units need to be initialized to for prepareMovement. The movement units are null, some of the movement reductions have no effect. No null ranges would be nice to have so that downstream code doesn't have to deal with that. In the context of detection modes a range of null is infinity: so there are chances that things go wrong with null ranges and a missing ?? 0 if the detection modes are prepared from the actors senses.

Yeah, definitely for units, but that makes sense for movement and senses as well