Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Even or Odd dice roll result

Hello everyone ! A bit of background: I am using PowerCards API and I did some nifty stuff in it but now I am stumped again. Here goes: I present to you ... CHAOS BOLT ! This power is very simple, at the table at least. If you see an even roll on the d20, you repeat the attack. Nothing fancy innit ? Well, in this Dice Roller™ things seem overly complicated and the logic is like a poor snake trying to go through a fence after eating one too many apples. What is my need exactly, then?| Check the d20 roll (and only the d20) if it is odd or even. If the d20 is odd - nothing happens. If the d20 is even - make a secondary attack. If that secondary attack d20 is even, repeat the secondary attack. Do so, until the d20 is odd and then stop.
TheAaron's Recursive Table API may be an available option for this. While I don't believe it would support the powercard itself, it can do the attack and damage rolls afterword. Entry 1 would be something like: Attk: [[1d10*2]] Dmg: [[d10]] <br/>[[1t[chaosbolttable]]] Entry 2 would be: Attk: [[(1d10*2)-1]] Dmg: [[d10]] Both entries would have a weight of 1. The reason the attack rolls are written as they are is so that they simulate the even or odd roll you'd get from a d20. The first entry is an even roll on the d20, which calculates everything, and then calls the table again. The second entry is an odd roll and ends the recursive calls.