kakaroto / Beyond20

D&D Beyond Character Sheet Integration in Roll20
GNU General Public License v3.0
497 stars 145 forks source link

Bugfix for Artificier Arcane Jolt #985

Closed Aeristoka closed 2 years ago

Aeristoka commented 2 years ago

Original code checked to make sure that the weapon being used did not have "Common" in the item_type, as Arcane Jolt requires a Magic Weapon. image

However, when an Artificer uses their Infusion on a weapon, the weapon still has an item_type of "Common", but with modified text. image

This change causes the "common (requires attunement)" check to be added and done first, so it supersedes the exclusion of strictly common items.

kakaroto commented 2 years ago

Humm... Is anything non-common magical? I also see it say "common" but the code checks for "Common", shouldn't it be all lower case and use item_type.toLowerCase() for the comparison? I think we can also probably just do it with /, common(?! \(requires attunement\))/i.test(item_type) as that checks for common and can't be followed by (requires attunement) and ignores case.

kakaroto commented 2 years ago

Much appreciated!