kakaroto / Beyond20

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

Implement Extra Damage from Vicious Weapons #983

Closed Aeristoka closed 2 years ago

Aeristoka commented 2 years ago

Vicious Weapons do an extra flat 7 Damage on attack rolls image

This is similar to Swords of Sharpness: image

Except DnDBeyond did not deign to implement the extra damage. This change makes the Vicious Weapons appear essentially the same as the Swords of Sharpness in rolls.

image

image

Aeristoka commented 2 years ago

I might figure out a fancier way to do this... not sure it would matter entirely, but I kinda want to poke at it.

kakaroto commented 2 years ago

Since they did it for the longsword of sharpness, this might be a case of 'better let DDB so they fix it from their side" otherwise we'll have issues when they do fix it and we're doubling it

Aeristoka commented 2 years ago

Since they did it for the longsword of sharpness, this might be a case of 'better let DDB so they fix it from their side" otherwise we'll have issues when they do fix it and we're doubling it

Then I'd have to go on the forums and request it (like someone did ~2.5 years ago with no reply)

kakaroto commented 2 years ago

Since they did it for the longsword of sharpness, this might be a case of 'better let DDB so they fix it from their side" otherwise we'll have issues when they do fix it and we're doubling it

Then I'd have to go on the forums and request it (like someone did ~2.5 years ago with no reply)

lol. Yeah. Maybe a poke will help them, though with the current acquisition/transition, they might be a bit busy. I'm not a fan though of trying to infer specific properties from the name. I'd accept it though if it did the following :

That could work for all items, not just "of sharpness" or "vicious" and might be a cleaner solution. Thoughts?

Aeristoka commented 2 years ago

Since they did it for the longsword of sharpness, this might be a case of 'better let DDB so they fix it from their side" otherwise we'll have issues when they do fix it and we're doubling it

Then I'd have to go on the forums and request it (like someone did ~2.5 years ago with no reply)

lol. Yeah. Maybe a poke will help them, though with the current acquisition/transition, they might be a bit busy. I'm not a fan though of trying to infer specific properties from the name. I'd accept it though if it did the following :

  • Check description of the item says "When you roll a 20 on the target ... (\d+) damage" and use that number from the description
  • AND, check that the damage isn't already included in the item's damage so it stops adding it if DDB fixes it.

That could work for all items, not just "of sharpness" or "vicious" and might be a cleaner solution. Thoughts?

Sounds like an interesting idea, but I'm so garbage at Regex, probably better that you do that 😄

kakaroto commented 2 years ago

Sounds like an interesting idea, but I'm so garbage at Regex, probably better that you do that 😄

urggg, I'm good with regexp, but the sentences are just soooo freaking different, it's not gonna be easy to regexp it, or even possible. Do you know/have a list of types of weapons with this kind of feature? If it's just vicious and 'of sharpness' weapons, then we can make it check for both separately... Just these checks :

const matchViciousWeapon = description.match("When you roll a 20 on your attack roll with this magic weapon, the target takes an extra (\d+) damage of the weapon’s type");
if (matchViciousWeapon) {
  damages.push(parseInt(matchViciousWeapon[1]);
  damage_types.push(damage_types[0]);
}
const matchSharpnessWeapon = description.match("When you attack a creature with this weapon and roll a 20 on the attack roll, that target takes an extra (\d+) slashing damage. ");
if (matchSharpnessWeapon) {
  damages.push(parseInt(matchSharpnessWeapon[1]);
  damage_types.push(damage_types[0]);
}
Aeristoka commented 2 years ago

Sounds like an interesting idea, but I'm so garbage at Regex, probably better that you do that 😄

urggg, I'm good with regexp, but the sentences are just soooo freaking different, it's not gonna be easy to regexp it, or even possible. Do you know/have a list of types of weapons with this kind of feature? If it's just vicious and 'of sharpness' weapons, then we can make it check for both separately... Just these checks :

const matchViciousWeapon = description.match("When you roll a 20 on your attack roll with this magic weapon, the target takes an extra (\d+) damage of the weapon’s type");
if (matchViciousWeapon) {
  damages.push(parseInt(matchViciousWeapon[1]);
  damage_types.push(damage_types[0]);
}
const matchSharpnessWeapon = description.match("When you attack a creature with this weapon and roll a 20 on the attack roll, that target takes an extra (\d+) slashing damage. ");
if (matchSharpnessWeapon) {
  damages.push(parseInt(matchSharpnessWeapon[1]);
  damage_types.push(damage_types[0]);
}
  • you know.. the check for whether that exact damage is already in the damages array so it doesn't double it once DDB fixes it

I think I've got it figured now.

Firstly, only "Vicious" needs the code, "Sharpness" weapons are all implemented properly. Also had to workaround the fact that Versatile weapons can have both damages present, and work the array. I feel pretty good about it now.