Fix Armor Expertise resistances on SF2e#21373
Fix Armor Expertise resistances on SF2e#21373surged20 wants to merge 1 commit intofoundryvtt:v13-devfrom
Conversation
|
Can we update the data field definition? It should cast any null value to 0 |
Yes, I see for melee items, it's using TraitConfigField in MeleeSystemData so this works. But for armor items, it's just using an interface with TraitConfig and so no model initialization logic (so trying this I see I still need an explicit janky |
|
Late reply but I think running the weapon through the trait config field at certain points is fine as a temporary workaround until weapons are data models. |
SF2e's Armor Expertise rule element references @armor.system.traits.config.resilient in its formula, but this property is only set when armor has a resilient-X trait. This caused formula resolution failures on SF2e actors with Armor Expertise when wearing armor without the resilient trait. Add `resilient` to TraitConfigField (initial: 0) and run items through it in prepareBaseData so the field is always initialized.
6ab7625 to
7f493da
Compare
Updated with this approach. I initially tried to add a clean traits helper that's used in addOrUpgradeTrait, but saw the build tooling doesn't like that since it needs to resolve runtime interfaces. Fell back to using the hardcoded init in that helper like with modular. FWIW, Obodaya (Level 7) is an existing actor that triggers this. |
SF2e's Armor Expertise rule element references
@armor.system.traits.config.resilient in its formula, but this property is only set when armor has a resilient-X trait. This caused formula resolution failures on SF2e actors with Armor Expertise when wearing armor without the resilient trait.
Initialize traits.config.resilient to 0 during prepareBaseData to ensure the property is always defined, matching the pattern used by PF2e's system.runes.potency field (which defaults to 0 via schema).