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

[#2094, #3537] Convert target value into formula, move prep logic #3538

Closed arbron closed 2 weeks ago

arbron commented 3 weeks ago

Converts the targets value into a formula field so spells can change their values as they upcast. In order to support this and reduce code duplication the formula resolution logic used by max uses & duration fields was moved into its own method. All of the activated effect template data preparation was also moved into the data model at the same time.

In order to ensure these formulas resolve properly using item data for non-embedded items (Bless should show targets even when not on an actor), this modifies getRollData to always return item data even for non-embedded items.

In addition, the replaceFormulaData method has been moved from Item5e into utils to make it more generally available.

Closes #3537