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 .
×

Need help with a complex dice command

So this is due to stacking several dice-tricks (rote,  8-again,  roll twice and take the best) in a game of Mage the Awakening and as a result the mechanics are wonky. the command is to roll an arbitrary number DICEPOOL of d10 dice. Then reroll every die with a result below 8. Once. Then for every die above 7, "Explode" by adding a new die and keep recursively exploding if the new die rolls above 7 Count the number of successes (dice above 7) Repeat the entire thing and take the better result. Or, to put it in psuedo-code int output = 0 do twice {     int successCount = 0;     Set<Dice> initialRollResult = rollD10s(DICEPOOL)      Set<Dice> unexplodedDice = new Set<>()     for each Dice initialDie in  initialRollResult      {         if(initialDie <8)          {             initialDie.reRoll()          }         unexplodedDice.add(initialDie)     }     for each Dice unexplodedDie in unexplodedDice      {         while(unexplodedDie >7)         {              successCount =  successCount +1             unexplodedDie.reroll()          }     }     if(successCount>output)     {         output = successCount;     }    } return output
1676825524

Edited 1676825565
Gauss
Forum Champion
Here you go: {?{Number of Dice?}d10ro<7!>8>8, ?{Number of Dice?} d10ro<7!>8>8}kh1
Gauss said: Here you go: {?{Number of Dice?}d10ro<7!>8>8, ?{Number of Dice?} d10ro<7!>8>8}kh1 thanks