
Hi there, im new to roll20, with only about 200 hours put in and im fairly new to coding in JS. However, in one of my campaigns I crafted a longbow for our ranger to use. The longbow is a +1 longbow, in addition, it adds 1d4 earth damage, and the intrinsic perk is its ability to ricochet the arrows off any surface. the player could make as many ricochets as he could intelligence saves that would increment by 2 with each successful save. The only damage applied to the enemies during this attack phase, is the 1d4 earth damage. My question is... what is a good place to start to create such an API that would first make the normal attack and damage rolls, then roll INT save, ask if it was a success, and if so continue rolling, damaging, and rolling again until a failed save?
Here is the exact description from my campaign
Longbow +1 When an arrow is fired from this bow, it becomes sheathed in an earthen casing allowing it to ricochet off any object's surface in the area. The arrow deals an additional 1d4 earth damage. The arrow ricochets as many times as the user can make an INT saving throw starting at a DC14 adding 2 to the DC per ricochet. Only the initial target takes the 1d8 arrow damage. Any successive ricochets only deal 1d4 earth damage.
If someone could help me that would be great, thanks!