foundryvtt / dnd5e

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

summon bonus damage has no type #3754

Open jtracey opened 3 weeks ago

jtracey commented 3 weeks ago

When adding bonus damage to a summon, it should have a type. This is important for properly applying resistances/vulnerabilities, or ensuring correct behavior for abilities that give temporary hit points.

I'm trying to implement a summoned protector cannon from the Artillerist subclass of Artificer, which adds the caster's spellcasting modifier to the temporary hp rolled, but the summon bonus damage type is hardcoded as the empty string. This means if I put a positive number in the "Bonus Healing" of the summon configuration, it gets dealt as damage to the target, while if I put a negative number, it gets added as normal healing instead of additional temporary hit points. In general, there isn't supposed to be such a thing as "typeless" damage in 5e, and bonus damage is supposed to be of the same type as the initial damage dealt.

I've confirmed that changing the line in question to

       if ( damageBonus && item.hasDamage ) changes.push({
         key: "system.damage.parts",
         mode: CONST.ACTIVE_EFFECT_MODES.ADD,
-         value: JSON.stringify([[`${damageBonus}`, ""]])
+         value: JSON.stringify([[`${damageBonus}`, item.system.damage.parts[0][1]]])
       });

seems to work as I think it should, and should be safe since it's gated by item.hasDamage, but it's possible a mainDamageType getter or an additional input field would be more appropriate.

arbron commented 3 weeks ago

I'm wondering if it might be better to handle this at the damage aggregation stage to make it more flexible beyond summons. Specifically when we are merging damage types for display/application, it might be good to treat any damage part without a type as belonging to the first part and whatever damage it has.